示例#1
0
        /// <summary>
        /// 绘制圆弧
        /// </summary>
        /// <params name="pCircleArc"></params>
        private void DrawArc(ICircularArc pCircleArc)
        {
            if (pCircleArc == null)
            {
                return;
            }

            ISegmentCollection pSegColl;
            IPolyline          pPolyline;

            pSegColl = new PolylineClass();
            pSegColl.AddSegment(pCircleArc as ISegment);
            pPolyline = pSegColl as IPolyline;

            IRgbColor pColor = new RgbColor();

            pColor.Red   = 0;
            pColor.Green = 0;
            pColor.Blue  = 0;

            m_LineSym       = new SimpleLineSymbol();
            m_LineSym.Color = pColor;
            m_LineSym.Width = 1;
            m_LineSym.Style = esriSimpleLineStyle.esriSLSSolid;

            ISymbol pSym = m_LineSym as ISymbol;

            pSym.ROP2 = esriRasterOpCode.esriROPNotXOrPen;
            m_pLineFeedback.Symbol = pSym;

            m_hookHelper.ActiveView.ScreenDisplay.StartDrawing(m_hookHelper.ActiveView.ScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
            m_hookHelper.ActiveView.ScreenDisplay.SetSymbol(pSym);
            m_hookHelper.ActiveView.ScreenDisplay.DrawPolyline(pPolyline);
            m_hookHelper.ActiveView.ScreenDisplay.FinishDrawing();
        }
        private void UpdateFeature(IFeature selectedFeature, ISegmentCollection polylineSegments)
        {
            ISegmentCollection polyline = new PolylineClass();

            polyline.AddSegmentCollection(polylineSegments);
            IFeatureClass  featureClass  = selectedFeature.Class as IFeatureClass;
            IDataset       dataset       = featureClass as IDataset;
            IWorkspaceEdit workspaceEdit = dataset.Workspace as IWorkspaceEdit;

            if (!(workspaceEdit.IsBeingEdited()))
            {
                return;
            }

            try
            {
                workspaceEdit.StartEditOperation();
                selectedFeature.Shape = polyline as IGeometry;
                selectedFeature.Store();
                workspaceEdit.StopEditOperation();
            }
            catch (Exception ex)
            {
                workspaceEdit.AbortEditOperation();
                MessageBox.Show("移动线段失败!!" + ex.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
    //----------------------------------------------------------------------------------

    public static IPolyline MaakPolyline()
    {
        //Declaraties en initialisaties
        IPolyline           pPolyline = new PolylineClass();
        IGeometryCollection pGCol     = (IGeometryCollection)pPolyline;
        IZAware             pZAware   = (IZAware)pPolyline;

        pZAware.ZAware = ImportInArcscene.ZBoolean;

        int aantalpaths = ImportInArcscene.binReader.ReadInt32();

        for (int i = 1; i <= aantalpaths; i++)
        {
            IPath            pPath     = new PathClass();
            IPointCollection pPointCol = (IPointCollection)pPath;

            int aantalvertices = ImportInArcscene.binReader.ReadInt32();

            for (int k = 1; k <= aantalvertices; k++)
            {
                double ptx = ImportInArcscene.binReader.ReadSingle();
                double pty = ImportInArcscene.binReader.ReadSingle();
                double ptz = ImportInArcscene.binReader.ReadSingle();
                pPointCol.AddPoint(PuntTransformatie(ptx, pty, ptz), ref _missing, ref _missing);
            }
            pGCol.AddGeometry(pPath, ref _missing, ref _missing);
        }
        return(pPolyline);
    }
示例#4
0
        /// <summary>
        /// Construct triangle fan outline
        /// </summary>
        /// <param name="triangleFanGeometry">triangle fan geometry</param>
        /// <returns>object implements IGeometryCollection</returns>
        public static IGeometryCollection ConstructTriangleFanOutline(IGeometry triangleFanGeometry)
        {
            IGeometryCollection outlineGeometryCollection = new GeometryBagClass();

            IPointCollection triangleFanPointCollection = triangleFanGeometry as IPointCollection;

            // TriangleFan: a linked fan of triangles, where every vertex (after the first two) completes a new triangle.
            //              A new triangle is always formed by connecting the new vertex with its immediate predecessor
            //              and the first vertex of the part.
            for (int i = 2; i < triangleFanPointCollection.PointCount; i++)
            {
                IPointCollection outlinePointCollection = new PolylineClass();

                outlinePointCollection.AddPoint(triangleFanPointCollection.get_Point(0), ref missing, ref missing);
                outlinePointCollection.AddPoint(triangleFanPointCollection.get_Point(i - 1), ref missing, ref missing);
                outlinePointCollection.AddPoint(triangleFanPointCollection.get_Point(i), ref missing, ref missing);

                // Simulate: Polygon.Close
                outlinePointCollection.AddPoint(triangleFanPointCollection.get_Point(0), ref missing, ref missing);

                IGeometry outlineGeometry = outlinePointCollection as IGeometry;

                MakeZAware(outlineGeometry);

                outlineGeometryCollection.AddGeometry(outlineGeometry, ref missing, ref missing);
            }

            return(outlineGeometryCollection);
        }
示例#5
0
        //----------------------------------干扰源定位中的绘制

        // 绘制线段
        public static void DrawLine(IPoint p1, IPoint p2, int r, int g, int b)
        {
            IPolyline line     = new PolylineClass();
            object    _missing = Type.Missing;

            line.FromPoint = p1;
            line.ToPoint   = p2;

            ISimpleLineSymbol lineSymbol = new SimpleLineSymbolClass();

            lineSymbol.Color = ColorUtilities.GetColor(r, g, b);
            lineSymbol.Width = 0.25;

            ILineElement lineElement = new LineElementClass();

            lineElement.Symbol = lineSymbol;

            IElement element = lineElement as IElement;

            element.Geometry = line as IGeometry;

            IGraphicsLayer       pLayer = (GISMapApplication.Instance.Scene as IBasicMap).BasicGraphicsLayer;
            IGraphicsContainer3D pGC    = pLayer as IGraphicsContainer3D;

            pGC.AddElement(element);
        }
示例#6
0
        public void ShowNavi()
        {
            IGraphicsContainer pGraphicsContainer = axMapControl1.Map as IGraphicsContainer;
            IActiveView        pActiveView        = axMapControl1.Map as IActiveView;

            // 得到“城市”图层
            IFeatureLayer pFeatureLayer = axMapControl1.get_Layer(0) as IFeatureLayer;
            IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
            int           indexFlield   = pFeatureClass.Fields.FindField("PointName");

            IPolyline        pPolyline        = new PolylineClass();
            IPointCollection pPointCollection = pPolyline as IPointCollection;

            IQueryFilter pQueryFilter = new QueryFilterClass();

            pQueryFilter.AddField("PointName");

            foreach (string staString in opPath)
            {
                pQueryFilter.WhereClause = "PointName='" + staString + "'";
                IFeatureCursor pCursor = pFeatureClass.Search(pQueryFilter, true);

                IFeature pFeature = pCursor.NextFeature();

                System.Runtime.InteropServices.Marshal.ReleaseComObject(pCursor);
                GC.Collect();
                GC.WaitForPendingFinalizers();

                if (pFeature != null)
                {
                    ESRI.ArcGIS.Geometry.Point pPoint = pFeature.Shape as ESRI.ArcGIS.Geometry.Point;
                    pPointCollection.AddPoint(pPoint);
                }
            }

            object    pSym = null;
            IRgbColor pColor;

            pColor       = new RgbColorClass();
            pColor.Red   = 0;
            pColor.Blue  = 255;
            pColor.Green = 0;

            pSym = new SimpleLineSymbolClass();
            ISimpleLineSymbol pSym1 = pSym as ISimpleLineSymbol;

            pSym1.Width = 6;
            pSym1.Style = esriSimpleLineStyle.esriSLSDash;
            pSym1.Color = pColor;

            ILineElement pLienElement = new LineElementClass();

            pLienElement.Symbol = pSym1;
            IElement pElement = pLienElement as IElement;

            pElement.Geometry = pPolyline as IGeometry;

            pGraphicsContainer.AddElement(pElement, 0);
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
示例#7
0
文件: EsriTools.cs 项目: VsPun/DPP
        /// <summary>
        /// Create a Polyline from two Points
        /// </summary>
        /// <param name="pointFrom">Start point</param>
        /// <param name="pointTo">End point</param>
        /// <returns>Esri poliline</returns>
        public static IPolyline CreatePolylineFromPoints(IPoint pointFrom, IPoint pointTo)
        {
            if (pointFrom == null || pointTo == null)
            {
                return(null);
            }

            WKSPoint[] segmentWksPoints = new WKSPoint[2];
            segmentWksPoints[0].X = pointFrom.X;
            segmentWksPoints[0].Y = pointFrom.Y;
            segmentWksPoints[1].X = pointTo.X;
            segmentWksPoints[1].Y = pointTo.Y;

            IPointCollection4 trackLine = new PolylineClass();

            IGeometryBridge2 m_geometryBridge = new GeometryEnvironmentClass();

            m_geometryBridge.AddWKSPoints(trackLine, ref segmentWksPoints);


            var result = trackLine as IPolyline;

            if (pointFrom.SpatialReference != null && pointTo.SpatialReference != null && pointFrom.SpatialReference == pointTo.SpatialReference)
            {
                result.SpatialReference = pointFrom.SpatialReference;
            }

            return(result);
        }
示例#8
0
        //获取应急资源调度路线
        public void GetIElement(Collection <RouteNode> routeNodes)
        {
            try
            {
                IPolyline           pPolyLine           = new PolylineClass();
                IGeometryCollection pGeometryCollection = pPolyLine as IGeometryCollection;
                object    pObject   = Type.Missing;
                IGeometry pGeometry = null;
                for (int i = 0; i < routeNodes.Count; i++)
                {
                    if (i == routeNodes.Count - 1)
                    {
                        break;
                    }
                    int    StartID = Convert.ToInt32(routeNodes[i].NodeID);
                    string EndID   = Convert.ToString(routeNodes[i + 1].NodeID);
                    Node   pNode   = NodeList[StartID - 1];

                    for (int j = 0; j < pNode.EdgeList.Count; j++)
                    {
                        if (pNode.EdgeList[j].EndNodeID == EndID)
                        {
                            pGeometry = pNode.EdgeList[j].line as IGeometry;
                            pGeometryCollection.AddGeometryCollection(pGeometry as IGeometryCollection);
                            break;
                        }
                    }
                }
                Variable.PElement.Geometry = pPolyLine;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n" + ex.ToString(), "异常");
            }
        }
        private void DrawLine(IPoint p1, IPoint p2)
        {
            IPolyline pline = new PolylineClass();

            pline.FromPoint = p1;
            pline.ToPoint   = p2;

            ILineElement lineElement;

            lineElement = new LineElementClass();
            IElement          element;
            ISimpleLineSymbol pSLnSym;
            IRgbColor         pRGB;

            pRGB               = new RgbColorClass();
            pRGB.Red           = 0;
            pRGB.Green         = 0;
            pRGB.Blue          = 0;
            pSLnSym            = new SimpleLineSymbolClass();
            pSLnSym.Color      = pRGB;
            pSLnSym.Style      = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid;
            lineElement.Symbol = pSLnSym;
            element            = lineElement as IElement;
            element.Geometry   = pline;
            IGraphicsContainer graphicsContainer = this.m_pMapControl.Map as IGraphicsContainer;

            graphicsContainer.AddElement(element, 0);
            this.m_pMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
        }
示例#10
0
 //根据线的方向获取其更新的位置
 private void GetFromPointMovepointChangeLocation(IPolyline line, double distance, ref IPoint point, ref IPolyline retureline)
 {
     try
     {
         IPolyline[] pLines     = new IPolyline[2];
         IPolyline   pSplitLine = new PolylineClass();
         pSplitLine = line;
         IPolyline StarttoPointLine = new PolylineClass();
         IPolyline EndtoPointLine   = new PolylineClass();
         bool      splithappened;
         int       partindex, segmentindex;
         object    pObject = Type.Missing;
         pSplitLine.SplitAtDistance(distance, false, false, out splithappened, out partindex, out segmentindex);
         ISegmentCollection lineSegCol  = pSplitLine as ISegmentCollection;
         ISegmentCollection startSegCol = StarttoPointLine as ISegmentCollection;
         ISegmentCollection endSegCol   = EndtoPointLine as ISegmentCollection;
         for (int i = 0; i < segmentindex; i++)
         {
             startSegCol.AddSegment(lineSegCol.get_Segment(i), ref pObject, ref pObject);
         }
         for (int j = segmentindex; j < lineSegCol.SegmentCount; j++)
         {
             endSegCol.AddSegment(lineSegCol.get_Segment(j), ref pObject, ref pObject);
         }
         pLines[0]  = endSegCol as IPolyline;
         pLines[1]  = startSegCol as IPolyline;
         point      = new PointClass();
         point      = pLines[0].FromPoint;
         retureline = pLines[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "/n" + ex.ToString(), "异常");
     }
 }
        private IGeometry GetGeometry(IGeometry baseGeometry)
        {
            IGeometry geometry;

            IPolyline polyline = new PolylineClass();

            polyline.SpatialReference = baseGeometry.SpatialReference;

            geometry = polyline as IGeometry;
            
            IPointCollection targetPointCollection = geometry as IPointCollection;

            IPointCollection basePointCollection = baseGeometry as IPointCollection;

            object missing = Type.Missing;

            for (int i = 0; i < basePointCollection.PointCount; i++)
            {
                targetPointCollection.AddPoint(basePointCollection.get_Point(i), ref missing, ref missing);
            }

            MakeZAware(geometry);

            return geometry;
        }
示例#12
0
        //function for generating camera to target direction
        public void cameraToTargetDirection(double camLat, double camLong, double camAlt, double tarLat, double tarLong, double tarAlt)
        {
            IPoint camPosition    = new PointClass();
            IPoint targetPosition = new PointClass();

            ICamera pCamera = (ICamera)globeCamera;

            IZAware obsZAware = (IZAware)camPosition;

            obsZAware.ZAware = true;

            camPosition.PutCoords(camLong, camLat);
            camPosition.Z = camAlt * 1000;

            IZAware targetZAware = (IZAware)targetPosition;

            targetZAware.ZAware = true;

            targetPosition.PutCoords(tarLong, tarLat);
            targetPosition.Z = tarAlt;

            IPolyline directionLine = new PolylineClass();
            IZAware   zAwareLine    = (IZAware)directionLine;

            zAwareLine.ZAware = true;

            directionLine.FromPoint = camPosition;
            directionLine.ToPoint   = targetPosition;


            addLineGraphicElements(directionLine, 255);
        }
示例#13
0
        /// <summary>
        /// ���ݵ㼯���������Ҫ��
        /// </summary>
        /// <params name="featureLayer"></params>
        /// <params name="lstPoint"></params>
        public void CreateLine(IFeatureLayer featureLayer, List<IPoint> lstPoint, int ID)
        {
            //try
            //{
            IFeatureClass featureClass = featureLayer.FeatureClass;
            if (featureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
            {
                IPointCollection multipoint = new MultipointClass();
                if (lstPoint.Count < 2)
                {
                    MessageBox.Show(@"��ѡ���������������ϵ�����", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                ISegmentCollection pPath = new PathClass();
                ILine pLine;
                ISegment pSegment;
                object o = Type.Missing;
                for (int i = 0; i < lstPoint.Count - 1; i++)
                {
                    pLine = new LineClass();
                    pLine.PutCoords(lstPoint[i], lstPoint[i + 1]);
                    pSegment = pLine as ISegment;
                    pPath.AddSegment(pSegment, ref o, ref o);
                }
                IGeometryCollection pPolyline = new PolylineClass();
                pPolyline.AddGeometry(pPath as IGeometry, ref o, ref o);

                IDataset dataset = (IDataset)featureClass;
                IWorkspace workspace = dataset.Workspace;
                IWorkspaceEdit workspaceEdit = workspace as IWorkspaceEdit;

                workspaceEdit.StartEditing(true);
                workspaceEdit.StartEditOperation();

                IFeature feature = featureClass.CreateFeature();

                IGeometry geometry = pPolyline as IGeometry;
                DrawCommon.HandleZMValue(feature, geometry);//����ͼ��Zֵ����

                feature.Shape = pPolyline as PolylineClass;
                int iFieldID = feature.Fields.FindField(GIS_Const.FIELD_BID);
                feature.Value[iFieldID] = ID.ToString();
                feature.Store();
                workspaceEdit.StopEditOperation();
                workspaceEdit.StopEditing(false);

                IEnvelope envelop = feature.Shape.Envelope;
                DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = envelop;
                DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
            }
            else
            {
                MessageBox.Show(@"��ѡ����ͼ�㡣", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            //}
            //catch
            //{
            //    return;
            //}
        }
示例#14
0
        private IGeometry CreateSymShape(ISymbol pSymbol, IEnvelope pEnvelope)
        {
            IGeometry geom = null;

            // This function returns an appropriate Geometry type depending on the Symbol type passed in.
            if (pSymbol is IMarkerSymbol)
            {
                // For a MarkerSymbol return a Point.
                IArea pArea = pEnvelope as IArea;
                geom = pArea.Centroid;
            }
            else if (pSymbol is ILineSymbol || pSymbol is ITextSymbol)
            {
                //For a LineSymbol or TextSymbol return a Polyline.
                IPolyline pPolyline = new PolylineClass();
                pPolyline.FromPoint = pEnvelope.LowerLeft;
                pPolyline.ToPoint   = pEnvelope.UpperRight;
                geom = pPolyline;
            }
            else
            {
                // For any FillSymbol return an Envelope.
                geom = pEnvelope;
            }
            return(geom);
        }
示例#15
0
        public void FlashLineOnWorkingGraphics(int profileId, int lineId)
        {
            var       curList       = allGraphics[MilSpaceGraphicsTypeEnum.Session];
            IGeometry flashGeometry = null;

            if (lineId > 0)
            {
                int elementId = lineId;

                var graphic = curList.FirstOrDefault(g => g.ProfileId == profileId && g.ElementId == elementId);
                if (graphic != null)
                {
                    flashGeometry = graphic.Source;
                }
            }
            else
            {
                var graphics = curList.Where(g => g.ProfileId == profileId).Select(g => g.Source).ToList();
                IGeometryCollection theGeomColl = new GeometryBagClass();
                graphics.ForEach(pl => theGeomColl.AddGeometry(pl));

                ITopologicalOperator theTopoOp = new PolylineClass();
                theTopoOp.ConstructUnion((IEnumGeometry)theGeomColl);

                flashGeometry = theTopoOp as IGeometry;
            }

            if (flashGeometry != null)
            {
                EsriTools.FlashGeometry(activeView.ScreenDisplay, flashGeometry);
                activeView.Refresh();
            }
        }
示例#16
0
        private IGeometry GetGeometry(IGeometry baseGeometry)
        {
            IGeometry geometry;

            IPolyline polyline = new PolylineClass();

            polyline.SpatialReference = baseGeometry.SpatialReference;

            geometry = polyline as IGeometry;

            IPointCollection targetPointCollection = geometry as IPointCollection;

            IPointCollection basePointCollection = baseGeometry as IPointCollection;

            object missing = Type.Missing;

            for (int i = 0; i < basePointCollection.PointCount; i++)
            {
                targetPointCollection.AddPoint(basePointCollection.get_Point(i), ref missing, ref missing);
            }

            MakeZAware(geometry);

            return(geometry);
        }
示例#17
0
 /// <summary>
 /// 处理线的顺序
 /// </summary>
 /// <params name="lines"></params>
 /// <returns></returns>
 private List <IPolyline> ProcLines(List <IPolyline> lines)
 {
     for (int i = 0; i < lines.Count - 1; i++)
     {
         for (int j = i + 1; j < lines.Count; j++)
         {
             IPoint pntprev = new PointClass()
             {
                 X = (lines[i].FromPoint.X + lines[i].ToPoint.X) / 2, Y = (lines[i].FromPoint.Y + lines[i].ToPoint.Y) / 2
             };
             IPoint pntnext = new PointClass()
             {
                 X = (lines[j].FromPoint.X + lines[j].ToPoint.X) / 2, Y = (lines[j].FromPoint.Y + lines[j].ToPoint.Y) / 2
             };
             IPolyline plin = new PolylineClass();
             if (pntprev.X > pntnext.X)
             {
                 plin     = lines[j];
                 lines[j] = lines[i];
                 lines[i] = plin;
             }
         }
     }
     return(lines);
 }
示例#18
0
        /// <summary>
        /// 在三维场景中由两点生成线的绘制   20110609
        /// </summary>
        /// <param name="Point1">前一个点要素</param>
        /// <param name="Point2">后一点要素</param>
        /// <param name="r"></param>
        /// <param name="g"></param>
        /// <param name="b"></param>
        /// <param name="Width">线符号宽</param>
        /// <returns></returns>
        public static IElement PointToPolyline(IPoint Point1, IPoint Point2, int r, int g, int b, double Width)
        {
            ILine line = new LineClass();

            line.PutCoords(Point1, Point2);
            object             missing = Type.Missing;
            ISegmentCollection segColl = new PolylineClass();

            segColl.AddSegment(line as ISegment, ref missing, ref missing);
            IPolyline pPolyline = new PolylineClass();

            pPolyline = segColl as IPolyline;
            IZAware pZAware = new PolylineClass();

            pZAware = pPolyline as IZAware;

            pZAware.ZAware = true;

            IElement            lineElement         = new LineElementClass();
            ISimpleLine3DSymbol pSimpleLine3DSymbol = new SimpleLine3DSymbolClass();

            pSimpleLine3DSymbol.Style             = esriSimple3DLineStyle.esriS3DLSWall;
            pSimpleLine3DSymbol.ResolutionQuality = 1;
            ILineSymbol pLineSymbol = pSimpleLine3DSymbol as ILineSymbol;

            pLineSymbol.Color    = getRGB(r, g, b);
            pLineSymbol.Width    = Width;
            lineElement.Geometry = pZAware as IGeometry;
            ILineElement lineElement2 = lineElement as ILineElement;

            lineElement2.Symbol = pLineSymbol;
            return(lineElement);
        }
        private IPolyline ConvertFrom(GeoAPI.Geometries.IMultiLineString lines)
        {
            if (lines == null)
            {
                return(null);
            }

            IPolyline           polyline = new PolylineClass();
            IGeometryCollection paths    = lines as IGeometryCollection;

            foreach (GeoAPI.Geometries.ILineString line in lines.Geometries)
            {
                IPath            path            = new PathClass();
                IPointCollection pointCollection = path as IPointCollection;
                object           Missing         = Type.Missing;
                IPoint           point           = new PointClass();
                foreach (GeoAPI.Geometries.ICoordinate coordinate in line.Coordinates)
                {
                    point.X = coordinate.X;
                    point.Y = coordinate.Y;
                    point.Z = coordinate.Z;
                    pointCollection.AddPoint(point, ref Missing, ref Missing);
                }
                paths.AddGeometry(path, ref Missing, ref Missing);
            }
            return(polyline);
        }
示例#20
0
        /// <summary>
        /// Construct triangles outline
        /// </summary>
        /// <param name="trianglesGeometry">triangles geometry</param>
        /// <returns>object implements IGeometryCollection</returns>
        public static IGeometryCollection ConstructTrianglesOutline(IGeometry trianglesGeometry)
        {
            IGeometryCollection outlineGeometryCollection = new GeometryBagClass();

            IPointCollection trianglesPointCollection = trianglesGeometry as IPointCollection;

            // Triangles: an unlinked set of triangles, where every three vertices completes a new triangle.
            if ((trianglesPointCollection.PointCount % 3) != 0)
            {
                throw new Exception("Triangles Geometry Point Count Must Be Divisible By 3. " + trianglesPointCollection.PointCount);
            }
            else
            {
                for (int i = 0; i < trianglesPointCollection.PointCount; i += 3)
                {
                    IPointCollection outlinePointCollection = new PolylineClass();

                    outlinePointCollection.AddPoint(trianglesPointCollection.get_Point(i), ref missing, ref missing);
                    outlinePointCollection.AddPoint(trianglesPointCollection.get_Point(i + 1), ref missing, ref missing);
                    outlinePointCollection.AddPoint(trianglesPointCollection.get_Point(i + 2), ref missing, ref missing);

                    // Simulate: Polygon.Close
                    outlinePointCollection.AddPoint(trianglesPointCollection.get_Point(i), ref missing, ref missing);

                    IGeometry outlineGeometry = outlinePointCollection as IGeometry;

                    MakeZAware(outlineGeometry);

                    outlineGeometryCollection.AddGeometry(outlineGeometry, ref missing, ref missing);
                }
            }

            return(outlineGeometryCollection);
        }
示例#21
0
        public override void OnDblClick()
        {
            IGeometry pGeometry;

            if (m_newBezierCurveFeedback != null)
            {
                m_newBezierCurveFeedback.AddPoint(fPoint);
            }
            pGeometry = m_newBezierCurveFeedback.Stop();
            IActiveView pActiveView = m_hookHelper.ActiveView;

            m_newBezierCurveFeedback = null;
            IPolyline polyline = new PolylineClass();

            polyline = (IPolyline)pGeometry;
            //polyline = DataEditCommon.PDFX(polyline, "Bezier");
            IPointCollection pointCollection = (IPointCollection)polyline;

            if (pointCollection.PointCount < 4)
            {
                MessageBox.Show("¹Ø¼üµã²»ÄÜСÓÚ3¸ö£¡");
                return;
            }
            //DrawFeatureByShape(m_pCurrentLayer, pGeometry);
            CollapsePillarsEntering form = new CollapsePillarsEntering(pointCollection);

            form.ShowDialog();
        }
示例#22
0
 /// <summary>
 /// 绘制矩形
 /// </summary>
 /// <params name="pLayer"></params>
 /// <params name="pScreenDisplay"></params>
 private void DrawRectangular(ILayer pLayer, IGeometry pGeo)
 {
     if (pLayer != null)
     {
         ISegmentCollection pSegmentCollection = null;
         if (pLayer is IFeatureLayer)
         {
             IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
             IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
             if (pFeatureClass != null)
             {
                 if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                 {
                     pSegmentCollection = new PolylineClass();
                 }
                 else if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                 {
                     pSegmentCollection = new PolygonClass();
                 }
                 pSegmentCollection.SetRectangle(pGeo.Envelope);
                 IFeature pFeature = DataEditCommon.CreateUndoRedoFeature(pFeatureLayer, (IGeometry)pSegmentCollection);
                 m_hookHelper.FocusMap.SelectFeature(m_pCurrentLayer, pFeature);
                 m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics | esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewBackground, null, null);
             }
         }
     }
 }
示例#23
0
        /// <summary>
        /// ¸ù¾ÝͼÐλæÖÆÒªËØ
        /// </summary>
        /// <params name="pLayer"></params>
        /// <params name="pGeometry"></params>
        private void DrawFeatureByShape(ILayer pLayer, IGeometry pGeometry)
        {
            if (pLayer != null)
            {
                if (pLayer is IFeatureLayer)
                {
                    IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
                    IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
                    if (pFeatureClass != null)
                    {
                        DataEditCommon.g_CurWorkspaceEdit.StartEditOperation();
                        IFeature  pCircleFeature = pFeatureClass.CreateFeature();
                        IPolyline polyline       = new PolylineClass();
                        polyline = (IPolyline)pGeometry;

                        pCircleFeature.Shape = polyline;
                        pCircleFeature.Store();
                        DataEditCommon.g_CurWorkspaceEdit.StopEditOperation();
                        m_pMap.SelectFeature(m_pCurrentLayer, pCircleFeature);

                        IActiveView pActiveView = (IActiveView)m_pMap;
                        m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);

                        ///ÒªËØÉÁ˸1.2£ºÐèÒª·ûºÅ
                        ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();
                        pSimpleLineSymbol.Color = GetRGBColor(255, 0, 0);
                        pSimpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                        pSimpleLineSymbol.Width = 8;
                        DataEditCommon.g_pAxMapControl.FlashShape(polyline, 40, 300, pSimpleLineSymbol);
                    }
                }
            }
        }
        //将收集到的点转换成线
        private IPolyline CreatePolyline(IPointCollection pPointcollection)
        {
            int PointNumber = int.Parse(pPointcollection.PointCount.ToString());

            object o = Type.Missing;

            //线数组
            ISegmentCollection pSegmentCollection = new PolylineClass();
            IZAware            z = pSegmentCollection as IZAware;
            IMAware            m = pSegmentCollection as IMAware;

            z.ZAware = true;
            m.MAware = true;

            for (int i = 0; i < PointNumber - 1; i++)
            {
                ILine pLine = new LineClass();

                pLine.PutCoords(pPointcollection.get_Point(i), pPointcollection.get_Point(i + 1));

                pSegmentCollection.AddSegment((ISegment)pLine, ref o, ref o);
            }
            IPolyline pPolyline = new PolylineClass();

            pPolyline = pSegmentCollection as IPolyline;

            return(pPolyline);
        }
示例#25
0
        /// <summary>
        /// Checks whether two cedges are equal disregarding the direction of the cedges
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool Equals(CAtBd other)
        {
            IPointCollection4 pThisCol = new PolylineClass();

            pThisCol = (IPointCollection4)this.pPolyline;

            IPointCollection4 potherCol = new PolylineClass();

            potherCol = (IPointCollection4)other.pPolyline;

            if (pThisCol.PointCount != potherCol.PointCount)
            {
                return(false);
            }


            bool blnEqual = true;

            for (int i = 0; i < pThisCol.PointCount; i++)
            {
                if ((pThisCol.get_Point(i).X != potherCol.get_Point(i).X) || (pThisCol.get_Point(i).Y != potherCol.get_Point(i).Y))
                {
                    blnEqual = false;
                    break;
                }
            }
            return(blnEqual);
        }
示例#26
0
 /// <summary>
 /// 显示轮廓线   张琪  20110629
 /// </summary>
 /// <param name="pPolygon"></param>
 private void ShowCountour(IPolygon pPolygon)
 {
     SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条");
     try
     {
         Cls3DMarkDraw.DeleteAllElementsWithName(m_pCurrentSceneControl.Scene, ContourName);
         if (!chkShowContour.Checked)
         {
             m_pCurrentSceneControl.SceneGraph.RefreshViewers();
             return;
         }
         vProgress.EnableCancel    = false;//设置进度条
         vProgress.ShowDescription = true;
         vProgress.FakeProgress    = true;
         vProgress.TopMost         = true;
         vProgress.ShowProgress();
         vProgress.SetProgress("正在绘制轮廓线");
         ITopologicalOperator pTopo     = pPolygon as ITopologicalOperator;
         IGeometry            pPolyLine = new PolylineClass();
         pPolyLine = pTopo.Boundary;
         object StepSize = Type.Missing;;
         m_SurFace.InterpolateShape(pPolyLine as IGeometry, out pPolyLine, ref StepSize);
         IGroupElement pGroup = null;
         //用于绘制三维效果
         Cls3DMarkDraw.AddSimpleGraphic(pPolyLine as IGeometry, Cls3DMarkDraw.getRGB(30, 255, 255), 4, ContourName, m_pCurrentSceneControl.Scene, pGroup);
         m_pCurrentSceneControl.SceneGraph.RefreshViewers();
         vProgress.Close();
     }
     catch
     {
         vProgress.Close();
     }
 }
		// Creates Route polyline
		private void CreatePolyline(ISMDirections objDirections)
		{
			// create polyline
			IPolyline objLine = null;
			objLine = new PolylineClass();

			// get points collection
			IPointCollection objPoints = null;
			objPoints = objLine as IPointCollection;

			// Adds Directions points to polyline
			AddPointsToPolyline(objDirections, ref objPoints);

			// Project points to Map projection
			IMxDocument objDoc = m_application.Document as IMxDocument;
			IMap objMap = objDoc.FocusMap;
			objLine.Project(objMap.SpatialReference);

			// create path graphics element
			IElement objElement = null;
			objElement = new LineElementClass();

			objElement.Geometry = objLine;

			// Set line color width and style
			SetLineProperties(objElement);

            // get Graphic container
			IGraphicsContainer objCont = objMap as IGraphicsContainer;

			// Add line to map
			objCont.AddElement(objElement, 0);
		}
示例#28
0
        private IElement method_8(IPoint ipoint_0, ILineSymbol ilineSymbol_0, string string_1)
        {
            IGroupElement element  = new GroupElementClass();
            IPolyline     polyline = new PolylineClass();
            object        missing  = Type.Missing;
            IPoint        inPoint  = new PointClass();

            inPoint.PutCoords(ipoint_0.X + (this.double_2 / 10.0), ipoint_0.Y - (this.double_3 / 2.0));
            (polyline as IPointCollection).AddPoint(inPoint, ref missing, ref missing);
            inPoint = new PointClass();
            inPoint.PutCoords(ipoint_0.X + (this.double_2 * 0.9), ipoint_0.Y - (this.double_3 / 2.0));
            (polyline as IPointCollection).AddPoint(inPoint, ref missing, ref missing);
            IElement element2 = new LineElementClass
            {
                Geometry = polyline
            };

            (element2 as ILineElement).Symbol = ilineSymbol_0;
            element.AddElement(element2);
            if (this.bool_1)
            {
                element.AddElement(this.method_9(ipoint_0));
            }
            if (string_1.Length > 0)
            {
                element.AddElement(this.method_12(ipoint_0, string_1, 10));
            }
            return(element as IElement);
        }
示例#29
0
        /// <summary>
        /// pPointCollection  所划线与管线的交点
        /// </summary>
        /// <returns></returns>
        public IPointCollection get_InsertPointColDepth(IPointCollection pPointCollection)
        {
            IPointCollection pResultPointCollection = new PolylineClass(); //地表插入点集合
            IPointCollection pTempPointCollection   = new PolylineClass(); //地表插入点集合

            ArrayList pArrayList = new ArrayList();

            for (int i = 0; i < pPointCollection.PointCount; i++)
            {
                pArrayList.Add(pPointCollection.get_Point(i).X);
            }
            pArrayList.Sort();

            object o = Type.Missing;

            for (int i = 0; i < pArrayList.Count; i++)
            {
                for (int j = 0; j < pPointCollection.PointCount; j++)
                {
                    if (pPointCollection.get_Point(j).X == Convert.ToDouble(pArrayList[i]))
                    {
                        //Console.WriteLine(pPointCollection.get_Point(j).X.ToString());

                        IPoint pNewPoint = new PointClass();
                        pNewPoint.X = pPointCollection.get_Point(j).X;
                        pNewPoint.Y = pPointCollection.get_Point(j).M + pPointCollection.get_Point(j).Z;
                        pResultPointCollection.AddPoint(pNewPoint, ref o, ref o);

                        break;
                    }
                }
            }
            m_XMin = pResultPointCollection.get_Point(0).X;
            return(pResultPointCollection);
        }
        public static IGeometry GetExample2()
        {
            const double FromZ = -0.1;
            const double ToZ = -8;

            //Extrusion: Multiple Point 2D Polyline Extruded To Generate 3D Wall Via ConstructExtrudeFromTo()

            IPointCollection polylinePointCollection = new PolylineClass();

            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-10, -10), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-8, -7), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-5, -5), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-3, -2), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(0, 0), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(3, 2), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(5, 5), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(8, 7), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(10, 10), ref _missing, ref _missing);

            IGeometry polylineGeometry = polylinePointCollection as IGeometry;

            ITopologicalOperator topologicalOperator = polylineGeometry as ITopologicalOperator;
            topologicalOperator.Simplify();

            IConstructMultiPatch constructMultiPatch = new MultiPatchClass();
            constructMultiPatch.ConstructExtrudeFromTo(FromZ, ToZ, polylineGeometry);

            return constructMultiPatch as IGeometry;
        }
示例#31
0
        /// <summary>
        /// 通过起点和终点创建线段(IPolyline对象)
        /// </summary>
        /// <param name="pt1">起点</param>
        /// <param name="pt2">终点</param>
        /// <returns></returns>
        public static IPolyline CreatePolyline(IPoint pt1, IPoint pt2)
        {
            //a. 创建Line对象(也可是其他Segment对象),
            //b. QI到Segment对象
            //c. 创建Path对象,通过Path的addSegment,将最初的Line添加进Path中
            //d. 创建GeometryCollection对象,通过AddGeometry,将path添加进GeometryCollection中
            //e. 将GeometryCollection QI到 IPolyline


            ILine line = new LineClass();                  // 创建一个Line对象

            line.PutCoords(pt1, pt2);                      // 设置LIne对象的起始终止点
            ISegment           segment = line as ISegment; // QI到ISegment
            ISegmentCollection path    = new PathClass();  // 创建一个Path对象

            object o = Type.Missing;

            path.AddSegment(segment, ref o, ref o);// 通过Isegmentcoletcion接口为Path对象添加Segment对象

            // 创建一个Polyline对象
            IGeometryCollection polyline = new PolylineClass();

            polyline.AddGeometry(path as IGeometry, ref o, ref o);

            IPolyline resultPolyline = polyline as IPolyline;

            return(resultPolyline);
        }
示例#32
0
        /// <summary>
        /// 根据圆心和半径绘制圆
        /// </summary>
        /// <params name="pLayer"></params>
        /// <params name="pPoint"></params>
        /// <params name="circleRadius"></params>
        /// <params name="pScreenDisplay"></params>
        private void DrawCircleByCenterAndRadius(ILayer pLayer, IPoint pPoint, double circleRadius, IScreenDisplay pScreenDisplay)
        {
            if (pLayer != null)
            {
                ISegmentCollection pSegmentCollection = null;
                if (pLayer is IFeatureLayer)
                {
                    IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
                    IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
                    if (pFeatureClass != null)
                    {
                        if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                        {
                            pSegmentCollection = new PolylineClass();
                        }
                        else if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                        {
                            pSegmentCollection = new PolygonClass();
                        }
                        //开始画圆
                        pSegmentCollection.SetCircle(pPoint, circleRadius);

                        IFeature pCircleFeature = pFeatureClass.CreateFeature();
                        pCircleFeature.Shape = pSegmentCollection as IGeometry;
                        pCircleFeature.Store();
                        //局部刷新
                        IInvalidArea pInvalidArea = new InvalidAreaClass();
                        pInvalidArea.Add(pSegmentCollection);
                        pInvalidArea.Display = pScreenDisplay;
                        pInvalidArea.Invalidate((short)esriScreenCache.esriAllScreenCaches);
                    }
                }
            }
        }
示例#33
0
文件: Form1.cs 项目: RiverTaig/GISIA
        private List <IPoint> CreateLinesAtStartPoint(int numberOfLines, ref int lineCounter, ref int juncCounter, ref int spCounter, IPoint startPoint,
                                                      double lineLength, double angleInRadians, IFeatureClass lineFC, IFeatureClass fuseFC, IFeatureClass serveFC, IFeatureClass juncFC)
        {
            List <IPoint> retList = new List <IPoint>();

            System.Random rnd     = new System.Random();
            double        starter = 1.0 / rnd.Next(1, 9);

            //starter = .5;
            for (double index = starter; index < numberOfLines; index++)
            {
                IConstructPoint outPoint = new PointClass();
                outPoint.ConstructAngleDistance(startPoint, angleInRadians * index, lineLength);
                IPoint           outPointpnt = outPoint as IPoint;
                IPointCollection pc          = new PolylineClass();
                pc.AddPoint(startPoint); pc.AddPoint(outPointpnt);
                IFeature lineFe = lineFC.CreateFeature();
                lineFe.Shape = pc as IGeometry;
                lineFe.Store();
                lineCounter++;
                ICurve curve = (ICurve)lineFe.ShapeCopy;
                bool   brs = false; double dfc = 0; double dac = 0;
                IPoint pntToNQ = new PointClass();
                if (lineLength > 200)
                {
                    for (int j = 0; j <= numberOfLines; j++)
                    {
                        dac = j * (1.0 / numberOfLines);
                        if (dac == 0)
                        {
                            IConstructPoint pntCP2 = new PointClass();
                            pntCP2.ConstructAlong(curve, esriSegmentExtension.esriNoExtension, 1, false);
                            IPoint   pntcp2pnt = (IPoint)pntCP2;
                            IFeature fuseFe    = fuseFC.CreateFeature();
                            fuseFe.Shape = pntcp2pnt as IGeometry;
                            fuseFe.Store();
                        }
                        else
                        {
                            IConstructPoint pntCP2 = new PointClass();
                            pntCP2.ConstructAlong(curve, esriSegmentExtension.esriNoExtension, dac, true);
                            IPoint   pntcp2pnt = (IPoint)pntCP2;
                            IFeature juncfe    = juncFC.CreateFeature();
                            juncfe.Shape = pntcp2pnt as IGeometry;
                            juncfe.Store();
                            retList.Add(pntcp2pnt as IPoint);
                            juncCounter++;
                        }
                    }
                }
                else
                {
                    IFeature servFe = serveFC.CreateFeature();
                    servFe.Shape = outPointpnt as IGeometry;
                    servFe.Store();
                    spCounter++;
                }
            }
            return(retList);
        }
示例#34
0
        /// <summary>
        /// ������ʵ��
        /// </summary>
        /// <param name="pITable">���ݱ����</param>
        /// <param name="entinyNode">VCT�ռ�ʵ��ڵ�</param>
        public override void CreateFeature(ITable pITable, EntityNode entinyNode)
        {
            try
            {
                IFeatureClass pFeatureCls = pITable as IFeatureClass;
                this.Feature =  pFeatureCls.CreateFeature();
                LineNode pLineNode = entinyNode as LineNode;

                if (pLineNode != null)
                {
                    ///��ʶ�븳ֵ
                    int dBSMIndex = -1;
                    dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled);
                    if (dBSMIndex != -1)
                        this.Feature.set_Value(dBSMIndex, pLineNode.EntityID);

                    ///Ҫ�ش��븳ֵ
                    int dSYDMIndex = -1;
                    dSYDMIndex = this.Feature.Fields.FindField(m_strYSDMField);
                    if (dSYDMIndex != -1)
                        this.Feature.set_Value(dSYDMIndex, pLineNode.FeatureCode);

                    ///�����ռ�����
                    int dLineNodeCount = pLineNode.SegmentNodes.Count;
                    IPointCollection pointCollection = new PolylineClass();
                    for (int i = 0; i < dLineNodeCount; i++)
                    {
                        //11��ʾ��������
                        if (Metadata.MetaDataFile.GraphConfig.GetGraphMark("LINETYPE", pLineNode.SegmentNodes[i].SegmentType.ToString()) == "BrokenLine")
                        {
                            BrokenLineNode pBLine = pLineNode.SegmentNodes[i] as BrokenLineNode;
                            foreach (PointInfoNode pPointInfoNode in pBLine.PointInfoNodes)
                            {
                                IPoint pPoint = new PointClass();
                                pPoint.PutCoords(pPointInfoNode.X, pPointInfoNode.Y);
                                object objType = Type.Missing;
                                pointCollection.AddPoint(pPoint, ref objType, ref objType);
                            }
                        }
                        else
                        {
                            //�������ʹ�������չ
                        }
                    }
                    (this.Feature as IFeature).Shape = pointCollection as IGeometry;

                    //feature.set_Value();
                    this.Feature.Store();
                }
            }
            catch(Exception ex)
            {
                Logger.WriteErrorLog(ex);
            }
        }
        private static void DrawAxis(IGraphicsContainer3D axesGraphicsContainer3D, IPoint axisFromPoint, IPoint axisToPoint, IColor axisColor, esriSimple3DLineStyle axisStyle, double axisWidth)
        {
            IPointCollection axisPointCollection = new PolylineClass();

            axisPointCollection.AddPoint(axisFromPoint, ref _missing, ref _missing);
            axisPointCollection.AddPoint(axisToPoint, ref _missing, ref _missing);

            GeometryUtilities.MakeZAware(axisPointCollection as IGeometry);

            GraphicsLayer3DUtilities.AddAxisToGraphicsLayer3D(axesGraphicsContainer3D, axisPointCollection as IGeometry, axisColor, axisStyle, axisWidth);
        }
示例#36
0
        private static IGeometry CreateTurnGeometry(IPoint ptStart, IPoint ptVia, IPoint ptEnd, ISpatialReference sr)
        {
            IPolyline lineTurn = new PolylineClass();
            lineTurn.SpatialReference = sr;

            IPointCollection pcTurn = lineTurn as IPointCollection;
            pcTurn.AddPoint(ptStart);
            pcTurn.AddPoint(ptVia);
            pcTurn.AddPoint(ptEnd);

            return (IGeometry)lineTurn;
        }
        private IGeometry GetGeometry(ISpatialReference spatialReference)
        {
            IGeometry geometry;

            IPolyline polyline = new PolylineClass();

            polyline.SpatialReference = spatialReference;

            geometry = polyline as IGeometry;

            MakeZAware(geometry);

            return geometry;
        }
示例#38
0
        protected override void OnClick()
        {
            //
            //  TODO: Sample code showing how to access button host
            //

            var referenceFactory2 = (ISpatialReferenceFactory2)new SpatialReferenceEnvironment();
            ISpatialReference WGS84 = referenceFactory2.CreateSpatialReference((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
            IPointCollection pointCollection = new PolylineClass();

            // ------------- Ensure that both points have negative longitude values -------------------
            IPoint point = new PointClass();
            point.PutCoords(-170, 10); // Equivalent to 170 degrees WEST
            point.SpatialReference = WGS84;
            pointCollection.AddPoint(point);


            point = new PointClass();
            point.PutCoords(-200, 10); // Equivalent to 160 degrees EAST
            point.SpatialReference = WGS84;
            pointCollection.AddPoint(point);
            // -----------------------------------------------------------------------

            IPolyline polyline = (IPolyline)pointCollection;
            polyline.SpatialReference = WGS84;

            var geometryDefEdit = (IGeometryDefEdit)new GeometryDef();
            geometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolyline;
            geometryDefEdit.SpatialReference_2 = WGS84;

            var field = (IFieldEdit)new Field();
            field.Name_2 = "Shape";
            field.Type_2 = esriFieldType.esriFieldTypeGeometry;
            field.GeometryDef_2 = geometryDefEdit;

            var fields = (IFieldsEdit)new Fields();
            fields.AddField(field);

            IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactory();
            var featureWorkspace = (IFeatureWorkspace)workspaceFactory.OpenFromFile("C:\\Temp\\", 0);
            IFeatureClass featureClass = featureWorkspace.CreateFeatureClass
                        ("test3.shp", fields, null, null, esriFeatureType.esriFTSimple, "Shape", "");

            var feature = featureClass.CreateFeature();
            feature.Shape = polyline;
            feature.Store();


            ArcMap.Application.CurrentTool = null;
        }
示例#39
0
 private void drawLineWithText(IPoint startPt, IPoint endPt, string text, bool horizontal)
 {
     IPolyline line = new PolylineClass();
     IPointCollection ptCol = line as IPointCollection;
     ptCol.AddPoint(startPt);
     ptCol.AddPoint(endPt);
     IPoint midPt = new PointClass();
     midPt.X = (startPt.X + endPt.X) / 2;
     midPt.Y = (startPt.Y + endPt.Y) / 2;
     if (horizontal)
     {
         midPt.Y = midPt.Y + textAdjustGap;
     }
     GisUtil.DrawPolyline(line, mapControl);
     GisUtil.drawText(text, midPt, textColor, mapControl);
 }
        /// <summary>
        /// 添加导线点线图层元素
        /// </summary>
        /// <params name="pnts"></params>
        /// <params name="layer"></params>
        public void AddDxdLines(List<IPoint> pnts, Dictionary<string, string> dics, IFeatureLayer layer, List<WirePoint> cols = null)
        {
            try
            {
                IFeatureClass Featureclass = layer.FeatureClass;
                IWorkspaceEdit workspace = (IWorkspaceEdit)(Featureclass as IDataset).Workspace;
                workspace.StartEditing(false);
                workspace.StartEditOperation();
                for (int i = 0; i < pnts.Count; i++)
                {
                    IFeature fealin = Featureclass.CreateFeature();
                    IPolyline plin = new PolylineClass();
                    ISegmentCollection segcols = plin as ISegmentCollection;
                    ICurve circle = Global.commonclss.CreateCircleArc(pnts[i], Global.radius, true);
                    segcols.AddSegment(circle as ISegment);
                    fealin.Shape = plin;
                    if (cols != null)
                    {
                        string name = cols[i].name;
                        int NamePos = fealin.Fields.FindField(GIS_Const.FIELD_NAME);
                        fealin.set_Value(NamePos, name);
                    }
                    foreach (string key in dics.Keys)
                    {
                        int findex = fealin.Fields.FindField(key);
                        if (findex != -1)
                        {
                            fealin.set_Value(findex, dics[key]);
                        }
                    }

                    fealin.Store();
                }
                workspace.StopEditOperation();
                workspace.StopEditing(true);
            }
            catch
            {
                throw;
            }
        }
 private IPolygon FlatBuffer(IPolyline pLline1, double pBufferDis)
 {
     object o = System.Type.Missing;
      //分别对输入的线平移两次(正方向和负方向)
      IConstructCurve pCurve1 = new PolylineClass();
      pCurve1.ConstructOffset(pLline1, pBufferDis, ref o, ref o);
      IPointCollection pCol = pCurve1 as IPointCollection;
      IConstructCurve pCurve2 = new PolylineClass();
      pCurve2.ConstructOffset(pLline1, -1 * pBufferDis, ref o, ref o);
      //把第二次平移的线的所有节点翻转
      IPolyline pline2 = pCurve2 as IPolyline;
      pline2.ReverseOrientation();
      //把第二条的所有节点放到第一条线的IPointCollection里面
      IPointCollection pCol2 = pline2 as IPointCollection;
      pCol.AddPointCollection(pCol2);
      //用面去初始化一个IPointCollection
      IPointCollection pPointCol = new PolygonClass();
      pPointCol.AddPointCollection(pCol);
      //把IPointCollection转换为面
      IPolygon pPolygon = pPointCol as IPolygon;
      //简化节点次序
      pPolygon.SimplifyPreserveFromTo();
      return pPolygon;
 }
示例#42
0
        private IPoint rotateCornerPoint(IPoint basePt, IPoint targetPt, double angle)
        {
            IPolyline line = new PolylineClass();
            IPointCollection ptCol = line as IPointCollection;
            ptCol.AddPoint(basePt);
            ptCol.AddPoint(targetPt);

            line = RotateGeom(line, angle, true) as IPolyline;

            IPoint afterMovePt = (line as IPointCollection).get_Point(1);
            targetPt = MovePoint(targetPt, afterMovePt.X - targetPt.X, afterMovePt.Y - targetPt.Y);

            return targetPt;
        }
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            ConfigUtil.type = "gas";
            string selectFeatures = ConfigUtil.GetConfigValue("Trace_Return_Selection", "false");
            bool selectEdges;
            if (selectFeatures.ToUpper() == "true".ToUpper() && Control.ModifierKeys == Keys.Control)
            {
                selectEdges = false;
            }
            else if (selectFeatures.ToUpper() == "true".ToUpper())
            {
                selectEdges = true;
            }
            else if (selectFeatures.ToUpper() == "false".ToUpper() && Control.ModifierKeys == Keys.Control)
            {
                selectEdges = true;
            }
            else
            {
                selectEdges = false;
            }

            bool traceIndeterminate = ConfigUtil.GetConfigValue("TraceFlow_Interminate", false);
            string ISOsourceFeatureLayerName = ConfigUtil.GetConfigValue("TraceIsolation_Source_FeatureLayer", "");
            string ISOvalveFeatureLayerName = ConfigUtil.GetConfigValue("TraceIsolation_Valve_FeatureLayer", "");
            string ISOoperableFieldNameValves = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Valves", "");
            string ISOoperableFieldNameSources = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Sources", "");

            string[] ISOoperableValues = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Values", "").Split('|');
            string ISOvalveAddSQL = ConfigUtil.GetConfigValue("TraceIsolation_Valve_AddSQL", "");
            double SnapTol = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0);
            string ClearFlagBeforeIso = ConfigUtil.GetConfigValue("TraceIsolation_ClearFlagsOnClick", "true");
            string closedValveQuery = ConfigUtil.GetConfigValue("TraceIsolation_Valve_ClosedValveQuery", "");

            Globals.RemoveTraceGraphics(((IMxDocument)ArcMap.Application.Document).FocusMap, false);

            Globals.ClearSelected(ArcMap.Application, false);

            if (ClearFlagBeforeIso.ToUpper() == "TRUE")
            {
                Globals.ClearGNFlags(ArcMap.Application, Globals.GNTypes.Flags);

            }
            IPolyline mergedLines = new PolylineClass();
            List<int> procoids = new List<int>();

            IPoint point = ArcMap.Document.CurrentLocation;
            bool addFlagBarScreen = ConfigUtil.GetConfigValue("TraceIsolation_AddResultsAsLayers", "false") == "false" ? false : true;

            string returnVal = GeoNetTools.TraceIsolation(new double[] { point.X }, new double[] { point.Y }, ArcMap.Application, ISOsourceFeatureLayerName, ISOvalveFeatureLayerName, ISOoperableFieldNameValves, ISOoperableFieldNameSources,
                SnapTol, true, ISOoperableValues, ISOvalveAddSQL, traceIndeterminate, true, selectEdges, "", "", "", closedValveQuery, null, out mergedLines, out procoids,addFlagBarScreen);
            if (returnVal != null)
            {
                string[] retVals = returnVal.Split('_');

                switch (retVals.Length)
                {
                    case 1:
                        break;
                    case 2:
                        MessageBox.Show(retVals[1]);
                        break;
                    case 3:
                        break;
                    default:
                        break;
                }
            }

            point = null;
        }
示例#44
0
        public bool isIntersect(IPolyline line)
        {
            //需要做四次相交, 分别是和四个边线.
            //左边边线.
            IPolyline boundLine = new PolylineClass();
            IPointCollection ptCol = boundLine as IPointCollection;
            ptCol.AddPoint(upperLeftPt);
            ptCol.AddPoint(lowerLeftPt);
            ITopologicalOperator tpOp = boundLine as ITopologicalOperator;
            IGeometry geom = tpOp.Intersect(line, esriGeometryDimension.esriGeometry0Dimension);
            if (!geom.IsEmpty)
            {
                return true;
            }

            //右边边线.
            boundLine = new PolylineClass();
            ptCol = boundLine as IPointCollection;
            ptCol.AddPoint(upperRightPt);
            ptCol.AddPoint(lowerRightPt);
            tpOp = boundLine as ITopologicalOperator;
            geom = tpOp.Intersect(line, esriGeometryDimension.esriGeometry0Dimension);
            if (!geom.IsEmpty)
            {
                return true;
            }

            //上边边线.
            boundLine = new PolylineClass();
            ptCol = boundLine as IPointCollection;
            ptCol.AddPoint(upperLeftPt);
            ptCol.AddPoint(upperRightPt);
            tpOp = boundLine as ITopologicalOperator;
            geom = tpOp.Intersect(line, esriGeometryDimension.esriGeometry0Dimension);
            if (!geom.IsEmpty)
            {
                return true;
            }

            //下边边线.
            boundLine = new PolylineClass();
            ptCol = boundLine as IPointCollection;
            ptCol.AddPoint(lowerLeftPt);
            ptCol.AddPoint(lowerRightPt);
            tpOp = boundLine as ITopologicalOperator;
            geom = tpOp.Intersect(line, esriGeometryDimension.esriGeometry0Dimension);
            if (!geom.IsEmpty)
            {
                return true;
            }

            return false;
        }
示例#45
0
        private IPoint RotateInnerPoint(IPoint oldPt)
        {
            IPolyline line = new PolylineClass();
            IPoint centerPt = getCenterPt();
            IPoint newPt = new PointClass();
            IPointCollection ptCol = line as IPointCollection;
            ptCol.AddPoint(centerPt);
            ptCol.AddPoint(oldPt);

            line = RotateGeom(line, rotateAngle, true) as IPolyline;
            newPt = (line as IPointCollection).get_Point(1);

            return newPt;
        }
        public void LoadTempImportFC(int SurveyID, int BatchID, int NextTransectID, IFeatureCursor ImportFCursor,
            IFeatureClass TempImportFC, IGeoDataset ThisDEM, double TargetLength, ref List<int> NewOIDs,
            ref int TotalInExcluded, ref int TotalOutsideBndy, ref int TotalPassed,string ThisDEMUnits, ref string ErrorMessage)
        {
            IFeature ImportFeature;
            IFeatureCursor ImportToCursor = null;
            IFeatureBuffer ImportToBuffer = null;
            esriGeometryType FType;
            bool IsInExcludedAreas, IsInBndPoly;
            ESRI.ArcGIS.GeoAnalyst.ISurfaceOp2 npsSurfaceOp = null;
            int ThisFieldIndex;
            IPoint TempPoint;
            IPolyline NewTrnPolyline;
            double Elev;
            IPolyline CPolyline;
            IPoint centerPoint;
            IFeatureClass ExclPolyFC, BndPolyFC;

            ThisDEMUnits = ThisDEMUnits.ToLower();
            NewOIDs = new List<int>();
            TotalInExcluded = 0;
            TotalOutsideBndy = 0;
            TotalPassed = 0;

            ExclPolyFC = Util.GetFeatureClass(m_NPS.LYR_EXCLUDED_AREAS, ref ErrorMessage);
            if (string.IsNullOrEmpty(ErrorMessage) == false) return;

            BndPolyFC = Util.GetFeatureClass(m_NPS.LYR_SURVEY_BOUNDARY, ref ErrorMessage);
            if (string.IsNullOrEmpty(ErrorMessage) == false) return;

            FType = TempImportFC.ShapeType;

            //get insert cursor in the nps feature class we are going to insert into
            ImportToCursor = TempImportFC.Insert(true);
            ImportToBuffer = TempImportFC.CreateFeatureBuffer();

            if (FType == esriGeometryType.esriGeometryPolyline)
                npsSurfaceOp = new ESRI.ArcGIS.GeoAnalyst.RasterSurfaceOpClass();

            //loop through each import feature and import it to it's appropriate featureclass
            while ((ImportFeature = ImportFCursor.NextFeature()) != null)
            {
                //make sure the shape is valid
                if (ImportFeature.ShapeCopy == null)
                {
                    TotalOutsideBndy++;
                    continue;
                }

                if (FType == esriGeometryType.esriGeometryPoint)
                {

                    //check if rand point  falls in excluded areas
                    IsInExcludedAreas = Util.HasRelationshipWithFC(ImportFeature.ShapeCopy, esriSpatialRelEnum.esriSpatialRelWithin,
                        ExclPolyFC, "SurveyID=" + SurveyID);

                    //if point is in excluded areas, don't add
                    if (IsInExcludedAreas)
                    {
                        TotalInExcluded++;
                        continue;
                    }

                    //check if  rand point is within boundary
                    IsInBndPoly = Util.HasRelationshipWithFC(ImportFeature.ShapeCopy, esriSpatialRelEnum.esriSpatialRelWithin,
                        BndPolyFC, "SurveyID=" + SurveyID);

                    //if random point is not in boundary, dont add it
                    if (IsInBndPoly == false)
                    {
                        TotalOutsideBndy++;
                        continue;
                    }

                }

                if (FType == esriGeometryType.esriGeometryPolyline)
                {

                    //check if new line falls in excluded areas
                    IsInExcludedAreas = Util.HasRelationshipWithFC(ImportFeature.ShapeCopy, esriSpatialRelEnum.esriSpatialRelCrosses,
                         ExclPolyFC, "SurveyID=" + SurveyID);

                    //if point is in excluded areas, don't add
                    if (IsInExcludedAreas)
                    {
                        TotalInExcluded++;
                        continue;
                    }

                    //check if new line is within in boundary
                    IsInBndPoly = Util.HasRelationshipWithFC(ImportFeature.ShapeCopy, esriSpatialRelEnum.esriSpatialRelWithin,
                         BndPolyFC, "SurveyID=" + SurveyID);

                    //if random point is not in boundary, dont add it
                    if (IsInBndPoly == false)
                    {
                        TotalOutsideBndy++;
                        continue;
                    }

                }

                TotalPassed++;

                //add feature to temp feature class
                ImportToBuffer.Shape = ImportFeature.ShapeCopy;
                ImportToBuffer.set_Value(ImportToBuffer.Fields.FindField("SurveyID"), SurveyID);
                ImportToBuffer.set_Value(ImportToBuffer.Fields.FindField("BATCH_ID"), BatchID);

                if (FType == esriGeometryType.esriGeometryPolyline)
                {

                    ThisFieldIndex = ImportToBuffer.Fields.FindField("Flown");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ImportToBuffer.Fields.FindField("Flown"), "N");

                    ThisFieldIndex = ImportToBuffer.Fields.FindField("TransectID");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ImportToBuffer.Fields.FindField("TransectID"), NextTransectID);

                    NextTransectID++;

                    NewTrnPolyline = ImportToBuffer.Shape as IPolyline;

                    ThisFieldIndex = ImportToBuffer.Fields.FindField("LENGTH_MTR");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, NewTrnPolyline.Length);

                    //add the name of the default projection
                    ThisFieldIndex = ImportToBuffer.Fields.FindField("PROJECTION");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, NewTrnPolyline.SpatialReference.Name);

                    ThisFieldIndex = ImportToBuffer.Fields.FindField("TARGETLEN");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TargetLength);

                    //clone from point
                    TempPoint = ((ESRI.ArcGIS.esriSystem.IClone)NewTrnPolyline.FromPoint).Clone() as IPoint;

                    //add from point projected coords
                    ThisFieldIndex = ImportToBuffer.Fields.FindField("PROJTD_X1");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.X);
                    ThisFieldIndex = ImportToBuffer.Fields.FindField("PROJTD_Y1");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.Y);

                    //add from point geo coords
                    ((IGeometry2)TempPoint).ProjectEx(Util.GetWGSSpatRef(), esriTransformDirection.esriTransformForward, null, false, 0, 0);
                    ThisFieldIndex = ImportToBuffer.Fields.FindField("DD_LONG1");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.X);
                    ThisFieldIndex = ImportToBuffer.Fields.FindField("DD_LAT1");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.Y);

                    //clone to point
                    TempPoint = ((ESRI.ArcGIS.esriSystem.IClone)NewTrnPolyline.ToPoint).Clone() as IPoint;

                    //add to point projected coords
                    ThisFieldIndex = ImportToBuffer.Fields.FindField("PROJTD_X2");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.X);
                    ThisFieldIndex = ImportToBuffer.Fields.FindField("PROJTD_Y2");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.Y);

                    //add to point geo coords
                    ((IGeometry2)TempPoint).ProjectEx(Util.GetWGSSpatRef(), esriTransformDirection.esriTransformForward, null, false, 0, 0);
                    ThisFieldIndex = ImportToBuffer.Fields.FindField("DD_LONG2");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.X);
                    ThisFieldIndex = ImportToBuffer.Fields.FindField("DD_LAT2");
                    if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.Y);

                    //get center point
                    centerPoint = new PointClass();
                    ((ICurve)NewTrnPolyline).QueryPoint(esriSegmentExtension.esriNoExtension, 0.5, true, centerPoint);

                    //get elevation for transect center
                    CPolyline = new PolylineClass();
                    npsSurfaceOp.ContourAsPolyline(ThisDEM, centerPoint, out CPolyline, out Elev);

                    //set elevation in meters
                    ThisFieldIndex = ImportToBuffer.Fields.FindField("ELEV_M");
                    if (ThisFieldIndex > -1)
                    {
                        if (ThisDEMUnits == "feet") ImportToBuffer.set_Value(ThisFieldIndex, 0.3048 * Elev);
                        if (ThisDEMUnits == "meters") ImportToBuffer.set_Value(ThisFieldIndex, Elev);

                    }

                    //get elevation in feet
                    ThisFieldIndex = ImportToBuffer.Fields.FindField("ELEVFT");
                    if (ThisFieldIndex > -1)
                    {
                        if (ThisDEMUnits == "feet") ImportToBuffer.set_Value(ThisFieldIndex, Elev);
                        if (ThisDEMUnits == "meters") ImportToBuffer.set_Value(ThisFieldIndex, Elev * 3.2808399);
                    }

                }

                NewOIDs.Add((int)Util.SafeConvert(ImportToCursor.InsertFeature(ImportToBuffer), typeof(int)));

            }

            ImportFCursor = null;
            ImportToCursor = null;
            ImportToBuffer = null;
        }
示例#47
0
文件: 1.cs 项目: trainsn/LBS
        /// <summary>
        /// 从导入的坐标串中生成草图
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void biImportToGraphic_ItemClick(object sender, ItemClickEventArgs e)
        {
            string filePath = "";
            object pbefore = Type.Missing;
            object pafter = Type.Missing;
            OpenFileDialog openDlg = new OpenFileDialog();
            openDlg.Filter = "Text files(*.txt)|*.txt";

            IPointCollection ipPoitCol = null;
            IGeometry iGeo = null;
            try
            {
                if (_subType == 1)
                {
                    ipPoitCol = new PolylineClass();
                }
                else if(_subType == 2)
                {
                    ipPoitCol = new PolygonClass();
                }

                if (openDlg.ShowDialog() == DialogResult.OK)
                {
                    filePath = openDlg.FileName;
                    StreamReader strRead = new StreamReader(filePath);
                    string strLine;
                    int RowCou = 0;
                    string strX = string.Empty;
                    string strY = string.Empty;
                    string[] strCoor = new string[2];
                    while ((strLine = strRead.ReadLine()) != null)
                    {
                        if (strLine != "")
                        {
                            RowCou++;
                            strCoor = strLine.Split(',');
                            double x = double.Parse(strCoor[0]);
                            double y = double.Parse(strCoor[1]);
                            if (RowCou == 1)
                            {
                                strX = strCoor[0];
                                strY = strCoor[1];
                            }
                            IPoint ipNewPoint = new PointClass();
                            ipNewPoint.PutCoords(x, y);
                            ipPoitCol.AddPoint(ipNewPoint, ref pbefore, ref pafter);
                        }
                    }
                    //如果第一个点和最后一个点不等,则再加一遍一个点的坐标
                    if (strX != strCoor[0] && strY != strCoor[1])
                    {
                        IPoint ipPoint = new PointClass();
                        ipPoint.PutCoords(double.Parse(strCoor[0]), double.Parse(strCoor[1]));
                        ipPoitCol.AddPoint(ipPoint, ref pbefore, ref pafter);
                    }
                    strRead.Close();
                }

                iGeo = ipPoitCol as IGeometry;

                if (iGeo != null)
                {
                    if (_subType == 1)
                        (_geometryFeedback as INewLineFeedback).Stop();
                    else if(_subType ==2)
                        (_geometryFeedback as INewPolygonFeedback).Stop();

                    TheReferenceInstances.TheAEditer.SketchEdit.DrawGeometry = iGeo;
                    _startPoint = null;

                    RefreshFeedBack();
                }
                else
                {
                    XtraMessageBox.Show("导入的点坐标不能构成面!", "提示");
                    return;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void OnSketchFinished()
        {
            ConfigUtil.type = "gas";
            IFeature pFeat = null;
            ISegmentCollection pSegColl = null;
            IEnumSegment pESeg = null;
            ISegment testSegment = null;
            ISegmentCollection segColTest = null;
            object Missing = null;
            try
            {
                // Send a shift-tab to hide the construction toolbar

                try
                {
                    m_editor.StartOperation();
                }
                catch
                {

                    m_editor.AbortOperation();
                    m_editor.StartOperation();
                }
                bool twoPoint = false;
                (ArcMap.Application.Document as IMxDocument).FocusMap.ClearSelection();
                List<IFeature> pLstFeat = null;
                if (Control.ModifierKeys == Keys.Control)
                {
                    twoPoint = CreateLineWithEndPoints.CreatePoints(ArcMap.Application, ConfigUtil.GetLinePointAtEndsConfig(), m_edSketch.Geometry as IPolyline, (IFeatureLayer)m_editor.CurrentTemplate.Layer, false, out pLstFeat);
                }
                else
                {
                    twoPoint = CreateLineWithEndPoints.CreatePoints(ArcMap.Application, ConfigUtil.GetLinePointAtEndsConfig(), m_edSketch.Geometry as IPolyline, (IFeatureLayer)m_editor.CurrentTemplate.Layer, true, out pLstFeat);
                }

                if (twoPoint)
                {

                    pSegColl = (ISegmentCollection)m_edSketch.Geometry;
                    pESeg = pSegColl.EnumSegments;
                    pESeg.Reset();

                    int partIndex = 0;
                    int segmentIndex = 0;

                    pESeg.Next(out testSegment, ref partIndex, ref segmentIndex);

                    while (testSegment != null)
                    {

                        segColTest = new PolylineClass();

                        Missing = Type.Missing;
                        segColTest.AddSegment(testSegment, ref Missing, ref Missing);

                        pFeat = Globals.CreateFeature(segColTest as IGeometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, false, true);
                        pFeat.Store();
                        pESeg.Next(out testSegment, ref partIndex, ref segmentIndex);
                    }
                }
                else
                {
                    pFeat = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, false, true);
                    pFeat.Store();

                }

                foreach (IFeature pFt in pLstFeat)
                {
                    pFt.Store();
                }
                pLstFeat = null;

                m_editor.StopOperation("Create line with points");
            }
            catch { }
            finally
            {
                pFeat = null;
                pSegColl = null;
                pESeg = null;
                testSegment = null;
                segColTest = null;
                Missing = null;

            }
        }
示例#49
0
        //���ƣȣ��ԣã�
        public static void HatchDraw(AxMapControl ppAxMapControl, ISimpleLineSymbol pHatchSymMajor, ISimpleLineSymbol pHatchSymMinor, ITextSymbol pTxtSym, IFeatureLayer pFeatLayer, bool bEnds, bool bEndsOnly, double dHatchLen, double dTxtInterval, double dHatchOffset, double dMajorAngle, bool bOverRideMajor, string graphicslayername)
        {
            //����ͼ��ͼ��ΪSEWER TV���ͼ��
            IFeatureCursor pFeatCursor = pFeatLayer.Search(null, true);
            SetGraphicsLayer(ppAxMapControl, pFeatLayer.Name, graphicslayername);
            //����SEWER TV���ͼ��ͼ��
            IGraphicsContainer pGraphicsContainer = ppAxMapControl.ActiveView.FocusMap.ActiveGraphicsLayer as IGraphicsContainer;
            //���ͼ��ͼ��
            pGraphicsContainer.DeleteAllElements();

            IFeature pFeature = pFeatCursor.NextFeature();
            IPolyline pMajorHatchPL = new PolylineClass();
            IPolyline pMinorHatchPL = new PolylineClass();
            IPolyline pPL;
            IMAware pPLM;
            //IMCollection pMColl;
            IGeometryCollection pGeomColl;
            ILineElement pLineElement;
            IElement pElement = null;
            int cnt;
            IPath pPath;
            string txt;
            double txtlen;
            IPath pTxtPath;
            double angle;
            //IPoint pTxtPt;
            ISegmentCollection pSC;
            ISegment pSeg;
            ISegmentM pSegM;
            double m1 = 0;
            //double m2 = 0;
            //IPoint pFromPt;
            //IMarkerSymbol pMSym;
            IMask pMask;
            ITextElement pTextElement;
            ISegmentCollection pSegment;
            ISegmentCollection pPolyline;
            while (pFeature != null)
            {
                pPL = pFeature.Shape as IPolyline;
                pPLM = pPL as IMAware;
                if (pPLM.MAware)
                {
                    if (bEndsOnly)
                    {
                        MakeHatchesEndsOnly(pPL, bEnds, pMajorHatchPL, pMinorHatchPL, dHatchLen, dTxtInterval, dHatchOffset);
                    }
                    else
                    {

                    }
                    // Draw the major hatches if they are lines
                    if (pHatchSymMajor is ILineSymbol)
                    {
                        pLineElement = new LineElementClass();
                        pLineElement.Symbol = pHatchSymMajor;
                        pElement = pLineElement as IElement;
                        pElement.Geometry = pMajorHatchPL as IGeometry;
                        pGraphicsContainer.AddElement(pElement, 0);
                    }
                    // Draw the major hatches if they are markers and the text...
                    pGeomColl = pMajorHatchPL as IGeometryCollection;
                    cnt = pGeomColl.GeometryCount - 1;
                    for (int j = 0; j <= cnt; j++)
                    {
                        pPath = pGeomColl.get_Geometry(j) as IPath;
                        if (bOverRideMajor)
                            angle = dMajorAngle;
                        else
                            angle = GetAngle(pPath) + dMajorAngle;
                        pSC = pPath as ISegmentCollection;
                        pSeg = pSC.get_Segment(0);
                        pSegM = pSeg as ISegmentM;
                        txt = Convert.ToString(Math.Round(m1, 1));
                        txtlen = pTxtSym.Size;
                        angle = GetAngle(pPath as ICurve);
                        if (ShouldFlip(angle))
                        {
                            pTxtPath = MakeTextPath(pPath, txtlen * 2);
                            angle += 180;
                            pTxtSym.RightToLeft = false;
                            pTxtSym.HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft;
                            pTxtSym.VerticalAlignment = esriTextVerticalAlignment.esriTVACenter;

                        }
                        else
                        {
                            //angle = angle;
                            pTxtPath = MakeTextPath(pPath, txtlen);
                            pTxtSym.RightToLeft = false;
                            pTxtSym.HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft;
                            pTxtSym.VerticalAlignment = esriTextVerticalAlignment.esriTVACenter;
                        }
                        pTxtSym.Angle = angle;
                        //Ϊ�ı�����MASK�����û�з��ţ�����Ϊ����
                        pMask = pTxtSym as IMask;
                        pMask.MaskSize = 2;
                        pMask.MaskStyle = esriMaskStyle.esriMSHalo;

                        pTextElement = new TextElementClass();
                        pTextElement.Symbol = pTxtSym;
                        pTextElement.Text = txt + " ";
                        pElement = pTextElement as IElement;

                        pSegment = pTxtPath as ISegmentCollection;
                        pPolyline = new PolylineClass();
                        pPolyline.AddSegmentCollection(pSegment);
                        pElement.Geometry = pPolyline as IGeometry;
                        pGraphicsContainer.AddElement(pElement, 0);
                    }
                }
                pFeature = pFeatCursor.NextFeature();
            }
        }
        private bool UpdateCircularArcValues(IFeatureClass LineTable, IQueryFilter QueryFilter, bool Unversioned, IDictionary<int, InferredCurve> CurveLookup, myProgessor progressor, Dictionary<int, int> MaxSequenceCache)
        {
            IFeature pLineFeat = null;
            IFeatureBuffer buffer = null;
            IFeatureCursor pLineCurs = null;
            IFeatureCursor pRadialCur = null;
            IFeatureCursor maxCursor = null;
            IDataStatistics dataStatistics = null;

            IGeometryFactory3 geometryFactory = new GeometryEnvironmentClass();
            IGeometry geometry = new PolylineClass();
            geometryFactory.CreateEmptyGeometryByType(LineTable.ShapeType, out geometry);

            IGeometryDef geometryDef = LineTable.Fields.get_Field(LineTable.FindField(LineTable.ShapeFieldName)).GeometryDef;

            if (geometryDef.HasZ)
            {
                IZAware zAware = (IZAware)(geometry);
                zAware.ZAware = true;
            }
            if (geometryDef.HasM)
            {
                IMAware mAware = (IMAware)(geometry);
                mAware.MAware = true;
            }


            try
            {
                CurveByInferenceSettings.FieldPositions positions = new CurveByInferenceSettings.FieldPositions((ITable)LineTable);

                buffer = LineTable.CreateFeatureBuffer();
                pLineCurs = LineTable.Update(QueryFilter, false);
                pRadialCur = LineTable.Insert(false);

                while ((pLineFeat = pLineCurs.NextFeature()) != null)
                {
                    //loop through all of the given lines, and update centerpoint ids, radius, and arc length values
                    if (!progressor.Continue())
                        return false;
                    progressor.Step();

                    InferredCurve curveInfo = CurveLookup[pLineFeat.OID];

                    pLineFeat.set_Value(positions.RadiusFieldIdx, curveInfo.InferredRadius);
                    pLineFeat.set_Value(positions.CenterpointIDFieldIdx, curveInfo.InferredCenterpointID);
                    IFeature feature = pLineFeat as IFeature;
                    double length = 0;
                    if (feature != null)
                    {
                        IPolyline polyline = feature.ShapeCopy as IPolyline;
                        if (polyline != null)
                        {
                            length = ((IProximityOperator)polyline.FromPoint).ReturnDistance(polyline.ToPoint);
                            pLineFeat.set_Value(positions.ArcLengthFieldIdx, length);
                            Marshal.ReleaseComObject(polyline);
                        }
                    }

                    if (Unversioned)
                        pLineCurs.UpdateFeature(pLineFeat);
                    else
                        pLineFeat.Store();

                    //fine the max sequence value 
                    int maxSequence = -1;
                    if (MaxSequenceCache.ContainsKey(curveInfo.Parcel))
                    {
                        maxSequence = MaxSequenceCache[curveInfo.Parcel];
                    }
                    else
                    {
                        maxCursor = LineTable.Search(new QueryFilter() {
                            SubFields = String.Format("{0}, {1}, {2}", LineTable.OIDFieldName, CurveByInferenceSettings.Instance.SequenceFieldName, CurveByInferenceSettings.Instance.ParcelIDFieldName),
                            WhereClause = String.Format("{0} = {1}", CurveByInferenceSettings.Instance.ParcelIDFieldName, curveInfo.Parcel) }, true);

                        int seqenceIdx = maxCursor.Fields.FindField(CurveByInferenceSettings.Instance.SequenceFieldName);

                        IRow maxFeat = null;
                        while ((maxFeat = maxCursor.NextFeature()) != null)
                        {
                            maxSequence = Math.Max((int)maxFeat.get_Value(seqenceIdx), maxSequence);
                            Marshal.ReleaseComObject(maxFeat);
                        }
                        Marshal.ReleaseComObject(maxCursor);

                        MaxSequenceCache.Add(curveInfo.Parcel, maxSequence);
                        dataStatistics = null;
                        maxCursor = null;                        
                    }
                    if (maxSequence <= 0)
                        throw new Exception("Failed to find max sequence value");

                    //the chord bearing
                    double featureBearing = (double)pLineFeat.get_Value(positions.BearingFieldIdx);

                    //half the delta of the proposed curve would be:
                    double halfdelta = toDegrees(Math.Asin(length / 2 / curveInfo.InferredRadius.Value));

                    //perpendicular to the chord
                    double perpendicular = (curveInfo.InferredRadius.Value > 0) ? featureBearing + 90 : featureBearing - 90;
                    if (perpendicular > 360)
                        perpendicular = perpendicular - 360;
                    else if (perpendicular < 0)
                        perpendicular = perpendicular + 360;

                    for (int i = 0; i < 2; i++)
                    {
                        buffer.set_Value(positions.ParcelIDFieldIdx, curveInfo.Parcel);
                        buffer.set_Value(positions.ToPointFieldIdx, curveInfo.InferredCenterpointID);
                        buffer.set_Value(positions.CategoryFieldIdx, 4);
                        buffer.set_Value(positions.SequenceFieldIdx, ++maxSequence);
                        buffer.set_Value(positions.TypeFieldIdx, 0);
                        buffer.set_Value(positions.DistanceFieldIdx, curveInfo.InferredRadius);
                        buffer.set_Value(positions.HistoricalFieldIdx, 0);
                        buffer.set_Value(positions.LineParametersFieldIdx, 0);
                        buffer.set_Value(positions.DensifyTypeIdx, 0);
                        buffer.set_Value(positions.SystemStartDateFieldIdx, pLineFeat.get_Value(positions.SystemStartDateFieldIdx));
                        buffer.Shape = geometry;

                        if (i == 0) // startpoing
                        {
                            buffer.set_Value(positions.FromPointFieldIdx, pLineFeat.get_Value(positions.FromPointFieldIdx));
                            buffer.set_Value(positions.BearingFieldIdx, perpendicular + halfdelta);
                        }
                        else  //endpoint
                        {
                            buffer.set_Value(positions.FromPointFieldIdx, pLineFeat.get_Value(positions.ToPointFieldIdx));
                            buffer.set_Value(positions.BearingFieldIdx, perpendicular - halfdelta);
                        }

                        pRadialCur.InsertFeature(buffer);
                    }

                    MaxSequenceCache[curveInfo.Parcel] = maxSequence; 
                    Marshal.ReleaseComObject(pLineFeat);
                }

                return true;
            }
            catch (COMException ex)
            {
                messageBox.Show(String.Format("Problem updating circular arc: {0} ({1})", ex.Message, ex.ErrorCode));
                return false;
            }
            finally
            {
                if(pLineCurs != null) Marshal.ReleaseComObject(pLineCurs);
                if(buffer != null) Marshal.ReleaseComObject(buffer);
                if(pRadialCur != null) Marshal.ReleaseComObject(pRadialCur);

                if(dataStatistics != null) Marshal.ReleaseComObject(dataStatistics);
                if (maxCursor != null) Marshal.ReleaseComObject(maxCursor);

                if (geometry != null) Marshal.FinalReleaseComObject(geometry);
                if (geometryFactory != null) Marshal.FinalReleaseComObject(geometryFactory);
            }
        }
        private static void ProfileGetRelatedElevData(IApplication app, List<ProfileGraphDetails> ProfileGraph, IGeometricNetwork pGeometricNet,
                  IEnumNetEID pResultEdges, IEnumNetEID pResultJunctions, int CurrentDetail,
                  ref IFeatureLayer pFLManhole, ref IFeatureLayer pFLMain, ref IFeatureLayer pFLTap)
        {
            List<mainDetails> SewerColMains = null;
            List<manholeDetails> SewerColManholes = null;
            List<tapDetails> SewerColTap = null;

            IEIDHelper pEIDHelperEdges = null;
            IEnumEIDInfo pEnumEIDInfoEdges = null;

            IEIDHelper pEIDHelperJunctions = null;
            IEnumEIDInfo pEnumEIDInfoJunctions = null;

            IPolyline pPolyline = null;
            IPointCollection pPtColl = null;

            IEIDInfo pEIDInfo = null;
            IPoint pNewPt = null;
            ISegmentCollection pSegColl = null;
            IMSegmentation pMSegmentation = null;
            IMAware pMAware = null;

            IPointCollection pPtCollection = null;
            IEnumVertex pEnumVertex;

            IHitTest pHtTest = null;
            IPoint pHitPntOne = null;
            IPoint pHitPntTwo = null;
            IFeature pFeature = null;
            Hashtable pFeatureAdded = null;
            mainDetails mainDet = null;

            IEdgeFeature pEdge = null;

            IPoint pGeoOne = null;
            IPoint pGeoTwo = null;
            IField pFld = null;
            IJunctionFeature pJunc = null;
            tapDetails tapDet = null;
            manholeDetails manDet = null;
            IFeatureLayer pFl = null;
            ISpatialFilter pSpatFilt = null;
            IFeatureCursor pFC = null;

            try
            {

                SewerColMains = new List<mainDetails>();
                SewerColManholes = new List<manholeDetails>();
                SewerColTap = new List<tapDetails>();

                pEIDHelperEdges = new EIDHelper();
                pEIDHelperEdges.GeometricNetwork = pGeometricNet;
                pEIDHelperEdges.ReturnFeatures = true;

                pEIDHelperEdges.ReturnGeometries = true;
                pEIDHelperEdges.PartialComplexEdgeGeometry = true;
                pEnumEIDInfoEdges = pEIDHelperEdges.CreateEnumEIDInfo(pResultEdges);

                pEnumEIDInfoEdges.Reset();  //edges

                pEIDHelperJunctions = new EIDHelperClass();
                pEIDHelperJunctions.GeometricNetwork = pGeometricNet;
                pEIDHelperJunctions.ReturnFeatures = true;
                pEIDHelperJunctions.ReturnGeometries = true;
                pEIDHelperJunctions.PartialComplexEdgeGeometry = true;
                pEnumEIDInfoJunctions = pEIDHelperJunctions.CreateEnumEIDInfo(pResultJunctions);
                pEnumEIDInfoJunctions.Reset();// junctions

                pPolyline = new PolylineClass();
                pPolyline.SpatialReference = (pFLMain as IGeoDataset).SpatialReference;

                pPtColl = (IPointCollection)pPolyline;  //QI

                for (int i = 0; i < pEnumEIDInfoJunctions.Count; i++)
                {

                    pEIDInfo = pEnumEIDInfoJunctions.Next();
                    pNewPt = (IPoint)pEIDInfo.Geometry;

                    pPtColl.AddPoint(pNewPt);

                }

                pSegColl = (ISegmentCollection)pPolyline;

                pPolyline.Densify(50, 0.01);

                pMAware = (IMAware)pPolyline;//'QI
                pMAware.MAware = true;
                pMSegmentation = (IMSegmentation)pPolyline;
                // get the M values, put the distance in m, 0 to Length
                pMSegmentation.SetMsAsDistance(false);

                pPtCollection = (IPointCollection)pPolyline;

                pEnumVertex = pPtCollection.EnumVertices;
                pEnumVertex.Reset();

                pHtTest = pPolyline as IHitTest;

                pHitPntOne = new PointClass();
                pHitPntTwo = new PointClass();
                double pHitDistOne = -1;
                double pHitDistTwo = -1;
                int pHitPrtOne = -1;
                int pHitPrtTwo = -1;
                int pHitSegOne = -1;
                int pHitSegTwo = -1;
                bool pHitSideOne = false;
                bool pHitSideTwo = false;

                pFeatureAdded = new Hashtable();

                pEnumEIDInfoEdges.Reset();  //edges
                int intUpStreamFld = pFLMain.FeatureClass.Fields.FindField(ProfileGraph[CurrentDetail].Line_UpStreamElevationField);
                int intDownStreamFld = pFLMain.FeatureClass.Fields.FindField(ProfileGraph[CurrentDetail].Line_DownStreamElevationField);
                if (intDownStreamFld < 0)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_19c") + ProfileGraph[CurrentDetail].Line_DownStreamElevationField + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_19b"));
                }
                if (intUpStreamFld < 0)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_19d") + ProfileGraph[CurrentDetail].Line_UpStreamElevationField + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_19b"));
                }
                for (int i = 0; i < pResultEdges.Count; i++)
                {
                    pEIDInfo = pEnumEIDInfoEdges.Next();
                    pFeature = pEIDInfo.Feature;
                    if (((IDataset)pFeature.Class).Name != ((IDataset)pFLMain.FeatureClass).Name)
                        continue;
                    if (pFeatureAdded.ContainsValue(pFeature.OID))
                        continue;

                    mainDet = new mainDetails();

                    pEdge = (IEdgeFeature)pFeature;

                    pGeoOne = (IPoint)pEdge.FromJunctionFeature.get_OriginalGeometryForJunctionElement(0);
                    pGeoTwo = (IPoint)pEdge.ToJunctionFeature.get_OriginalGeometryForJunctionElement(0);

                    pFeature = ((IFeatureClass)pFeature.Class).GetFeature(pFeature.OID);

                    bool bHitOne = pHtTest.HitTest(pGeoOne, .1,
                                            esriGeometryHitPartType.esriGeometryPartVertex,
                                            pHitPntOne, ref pHitDistOne, ref pHitPrtOne, ref pHitSegOne, ref pHitSideOne);
                    bool bHitTwo = pHtTest.HitTest(pGeoTwo, .1,
                                   esriGeometryHitPartType.esriGeometryPartVertex,
                                   pHitPntTwo, ref pHitDistTwo, ref pHitPrtTwo, ref pHitSegTwo, ref pHitSideTwo);
                    if (bHitOne && bHitTwo)
                    {
                        if (pHitPntOne.M < pHitPntTwo.M)
                        {
                            mainDet.UpM = pHitPntOne.M;
                            mainDet.DownM = pHitPntTwo.M;
                            if (intUpStreamFld > 0)
                            {
                                if (pFeature.get_Value(intUpStreamFld).ToString() != "")
                                {
                                    mainDet.UpElev = Convert.ToDouble(pFeature.get_Value(intUpStreamFld));
                                }
                                else
                                    mainDet.UpElev = -9999;
                            }
                            else
                                mainDet.UpElev = -9999;

                            if (intDownStreamFld > 0)
                            {
                                if (pFeature.get_Value(intDownStreamFld).ToString() != "")
                                {
                                    mainDet.DownElev = Convert.ToDouble(pFeature.get_Value(intDownStreamFld));
                                }
                                else
                                    mainDet.DownElev = -9999;
                            }
                            else
                                mainDet.DownElev = -9999;
                        }
                        else
                        {
                            mainDet.DownM = pHitPntOne.M;
                            mainDet.UpM = pHitPntTwo.M;
                            if (intUpStreamFld > 0)
                            {
                                if (pFeature.get_Value(intUpStreamFld) != null && pFeature.get_Value(intUpStreamFld).ToString() != "")
                                {
                                    mainDet.DownElev = Convert.ToDouble(pFeature.get_Value(intUpStreamFld));
                                }
                                else
                                    mainDet.DownElev = -9999;
                            }
                            else
                                mainDet.DownElev = -9999;

                            if (intDownStreamFld > 0)
                            {
                                if (pFeature.get_Value(intDownStreamFld) != null && pFeature.get_Value(intDownStreamFld).ToString() != "")
                                {
                                    mainDet.UpElev = Convert.ToDouble(pFeature.get_Value(intDownStreamFld));
                                }
                                else
                                    mainDet.UpElev = -9999;
                            }
                            else
                                mainDet.UpElev = -9999;

                        }
                        string label = "";
                        for (int l = 0; l < ProfileGraph[CurrentDetail].Line_Labels.Length; l++)
                        {
                            if (pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Line_Labels[l]) > 0)
                            {
                                int fldIdx = pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Line_Labels[l]);

                                pFld = pFeature.Fields.get_Field(fldIdx);

                                if (pFeature.get_Value(fldIdx) != null)
                                {
                                    if (label == "")
                                    {
                                        label = Globals.GetDomainDisplay(pFeature.get_Value(fldIdx), pFeature, pFld);
                                    }
                                    else
                                    {

                                        label = label + "\r\n" + Globals.GetDomainDisplay(pFeature.get_Value(fldIdx), pFeature, pFld);

                                    }
                                }
                            }
                        }

                        mainDet.Label = label;

                    }

                    if (pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Line_IDField) > 0)
                    {
                        if (pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Line_IDField)) != null && pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Line_IDField)).ToString() != "")
                        {
                            mainDet.MainID = Convert.ToString(pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Line_IDField)));
                        }
                        else
                            mainDet.MainID = "Unk";
                    }
                    else
                        mainDet.MainID = "Unk";

                    pFeatureAdded.Add(pFeature.OID, pFeature.OID);
                    SewerColMains.Add(mainDet);

                }

                pFeatureAdded = new Hashtable();

                pEnumEIDInfoJunctions.Reset();
                for (int i = 0; i < pEnumEIDInfoJunctions.Count; i++)
                {

                    pEIDInfo = pEnumEIDInfoJunctions.Next();
                    pFeature = pEIDInfo.Feature;
                    if (pFLTap != null)
                    {
                        if (((IDataset)pFeature.Class).Name == ((IDataset)pFLTap.FeatureClass).Name)
                        {
                            pJunc = (IJunctionFeature)pFeature;
                            pFeature = ((IFeatureClass)pFeature.Class).GetFeature(pFeature.OID);
                            pHitPntOne = new PointClass();
                            bool bHit = pHtTest.HitTest(pFeature.Shape as IPoint, .1,
                                                    esriGeometryHitPartType.esriGeometryPartVertex,
                                                    pHitPntOne, ref pHitDistOne, ref pHitPrtOne, ref pHitSegOne, ref pHitSideOne);

                            if (bHit)
                            {
                                tapDet = new tapDetails();

                                tapDet.M = pHitPntOne.M;

                                if (pFeature.Fields.FindField(ProfileGraph[CurrentDetail].PointAlong_IDField) > 0)
                                {
                                    if (pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].PointAlong_IDField)) != null &&
                                        pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].PointAlong_IDField)).ToString() != "")
                                    {
                                        tapDet.tapID = pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].PointAlong_IDField)).ToString();
                                    }
                                    else
                                        tapDet.tapID = "Unk";
                                }
                                else
                                    tapDet.tapID = "Unk";

                                string label = "";
                                for (int l = 0; l < ProfileGraph[CurrentDetail].PointAlong_Labels.Length; l++)
                                {
                                    if (pFeature.Fields.FindField(ProfileGraph[CurrentDetail].PointAlong_Labels[l]) > 0)
                                    {
                                        int fldIdx = pFeature.Fields.FindField(ProfileGraph[CurrentDetail].PointAlong_Labels[l]);

                                        pFld = pFeature.Fields.get_Field(fldIdx);

                                        if (pFeature.get_Value(fldIdx) != null)
                                        {
                                            if (label == "")
                                            {
                                                label = Globals.GetDomainDisplay(pFeature.get_Value(fldIdx), pFeature, pFld);
                                            }
                                            else
                                            {

                                                label = label + "\r\n" + Globals.GetDomainDisplay(pFeature.get_Value(fldIdx), pFeature, pFld);

                                            }
                                        }
                                    }
                                }

                                tapDet.tapLabel = label;
                                SewerColTap.Add(tapDet);
                            }

                        }
                    }
                    if (((IDataset)pFeature.Class).Name == ((IDataset)pFLManhole.FeatureClass).Name)
                    {
                        if (pFeatureAdded.ContainsValue(pFeature.OID))
                            continue;

                        pJunc = (IJunctionFeature)pFeature;
                        pFeature = ((IFeatureClass)pFeature.Class).GetFeature(pFeature.OID);
                        pHitPntOne = new PointClass();
                        bool bHit = pHtTest.HitTest(pFeature.Shape as IPoint, .1,
                                                esriGeometryHitPartType.esriGeometryPartVertex,
                                                pHitPntOne, ref pHitDistOne, ref pHitPrtOne, ref pHitSegOne, ref pHitSideOne);

                        if (bHit)
                        {
                            manDet = new manholeDetails();

                            manDet.M = pHitPntOne.M;

                            if (pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_TopElevationField) > 0)
                            {
                                if (pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_TopElevationField)) != null &&
                                    pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_TopElevationField)).ToString() != "")
                                {
                                    manDet.Top = (double)pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_TopElevationField));
                                }
                                else
                                    manDet.Top = -9999;
                            }
                            else
                                manDet.Top = -9999;

                            if (pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_BottomElevationField) > 0)
                            {
                                if (pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_BottomElevationField)) != null &&
                                    pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_BottomElevationField)).ToString() != "")
                                {
                                    manDet.Bottom = (double)pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_BottomElevationField));
                                    if (pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_BottomElevationTypeField) > 0)
                                    {
                                        if (pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_BottomElevationTypeField)) != null &&
                                            pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_BottomElevationTypeField)).ToString() != "")
                                        {
                                            if (pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_BottomElevationTypeField)).ToString().ToUpper() == "INVERT")
                                                manDet.Bottom = manDet.Top - (double)pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_BottomElevationTypeField));
                                        }
                                    }

                                }
                                else
                                    manDet.Bottom = -9999;
                            }
                            else
                                manDet.Bottom = -9999;

                            //if (pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_InvertElevationField) > 0)
                            //{
                            //    if (pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_InvertElevationField)) != null && pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_InvertElevationField)).ToString() != "")
                            //    {
                            //        manDet.InvertElev = (double)pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_InvertElevationField));
                            //    }
                            //    else
                            //        manDet.InvertElev = -9999;
                            //}
                            //else
                            //    manDet.InvertElev = -9999;

                            //if (pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_InvertField) > 0)
                            //{
                            //    if (pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_InvertField)) != null && pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_InvertField)).ToString() != "")
                            //    {
                            //        manDet.Invert = (double)pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_InvertField));
                            //    }
                            //    else
                            //        manDet.Invert = -9999;
                            //}
                            //else
                            //    manDet.Invert = -9999;

                            //if (pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_RimElevationField) > 0)
                            //{
                            //    if (pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_RimElevationField)) != null && pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_RimElevationField)).ToString() != "")
                            //    {
                            //        manDet.Rim = (double)pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_RimElevationField));
                            //    }
                            //    else
                            //        manDet.Rim = -9999;
                            //}
                            //else
                            //    manDet.Rim = -9999;

                            if (pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_IDField) > 0)
                            {
                                if (pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_IDField)) != null && pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_IDField)).ToString() != "")
                                {
                                    manDet.ManholeID = pFeature.get_Value(pFeature.Fields.FindField(ProfileGraph[CurrentDetail].Point_IDField)).ToString();
                                }
                                else
                                    manDet.ManholeID = "UNK";
                            }
                            else
                                manDet.ManholeID = "UNK";

                            pFeatureAdded.Add(pFeature.OID, pFeature.OID);
                            SewerColManholes.Add(manDet);
                        }
                    }

                }
                if (ProfileGraph[CurrentDetail].Lines_Along != null)
                {
                    if (ProfileGraph[CurrentDetail].Lines_Along.Length > 0)
                    {

                        pSpatFilt = new SpatialFilterClass();
                        pSpatFilt.Geometry = pPolyline;
                        pSpatFilt.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;

                        for (int i = 0; i < ProfileGraph[CurrentDetail].Lines_Along.Length; i++)
                        {
                            bool FCorLayerTemp = true;
                            pFl = (IFeatureLayer)Globals.FindLayer(app, ProfileGraph[CurrentDetail].Lines_Along[i].Layer_Name, ref FCorLayerTemp);
                            if (pFl != null)
                            {

                                intUpStreamFld = pFl.FeatureClass.Fields.FindField(ProfileGraph[CurrentDetail].Lines_Along[i].Line_UpStreamElevationField);
                                intDownStreamFld = pFl.FeatureClass.Fields.FindField(ProfileGraph[CurrentDetail].Lines_Along[i].Line_DownStreamElevationField);
                                int intIdFld = pFl.FeatureClass.Fields.FindField(ProfileGraph[CurrentDetail].Lines_Along[i].Line_IDField);
                                if (intIdFld < 0)
                                {
                                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_19f") + ProfileGraph[CurrentDetail].Lines_Along[i].Line_IDField + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_19e") + ProfileGraph[CurrentDetail].Lines_Along[i].Layer_Name);
                                }
                                if (intDownStreamFld < 0)
                                {
                                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_19c") + ProfileGraph[CurrentDetail].Lines_Along[i].Line_DownStreamElevationField + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_19e") + ProfileGraph[CurrentDetail].Lines_Along[i].Layer_Name);
                                }
                                if (intUpStreamFld < 0)
                                {
                                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_19d") + ProfileGraph[CurrentDetail].Lines_Along[i].Line_UpStreamElevationField + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_19e") + ProfileGraph[CurrentDetail].Lines_Along[i].Layer_Name);
                                }

                                pSpatFilt.GeometryField = pFl.FeatureClass.ShapeFieldName;

                                pFC = pFl.Search(pSpatFilt, true);

                            }
                        }
                    }
                }

                ProfileCreateGraph(app, ProfileGraph, pPolyline, SewerColMains, SewerColManholes, SewerColTap, CurrentDetail);

            }
            catch (Exception Ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + "ProfileGetRelatedSewerElevData " + Ex.Message);
            }
            finally
            {

                SewerColMains = null;
                SewerColManholes = null;
                SewerColTap = null;

                pEIDHelperEdges = null;
                pEnumEIDInfoEdges = null;

                pEIDHelperJunctions = null;
                if (pEnumEIDInfoJunctions != null)
                    Marshal.ReleaseComObject(pEnumEIDInfoJunctions);

                pEnumEIDInfoJunctions = null;

                pPolyline = null;
                pPtColl = null;

                pEIDInfo = null;
                pNewPt = null;
                pSegColl = null;
                pMSegmentation = null;
                pMAware = null;

                pPtCollection = null;
                pEnumVertex = null;

                pHtTest = null;
                pHitPntOne = null;
                pHitPntTwo = null;
                pFeature = null;
                pFeatureAdded = null;
                mainDet = null;

                pEdge = null;

                pGeoOne = null;
                pGeoTwo = null;
                pFld = null;
                pJunc = null;
                tapDet = null;
                manDet = null;
                pFl = null;
                pSpatFilt = null;
                if (pFC != null)
                    Marshal.ReleaseComObject(pFC);

                pFC = null;

            }
        }
示例#52
0
        public static IGeometry get_GraphicShape(IEnumElement theElements, int a_Dimensionality, bool multipart)
        {
            IGeometry theReturn = null;
            IGeometryCollection theGeomColl = null;
            object missing = Type.Missing;

            if (theElements != null)
            {
                theElements.Reset();
                IElement theElement = theElements.Next();
                while (theElement != null)
                {
                    if (theGeomColl == null)
                        theGeomColl = new GeometryBagClass();

                    IGeometry theShape = null;
                    if (theElement is IGroupElement)
                    {
                        theShape = get_GraphicShape(((IGroupElement)theElement).Elements, a_Dimensionality, multipart);
                    }
                    else if (theElement is ICircleElement
                        || theElement is IPolygonElement
                        || theElement is IRectangleElement
                        || theElement is IEllipseElement
                        || theElement is ILineElement
                        || theElement is IMarkerElement)
                        theShape = theElement.Geometry;

                    if (theShape != null)
                        theGeomColl.AddGeometry(theShape, ref missing, ref missing);

                    theElement = theElements.Next();
                }
            }

            if (theGeomColl != null && theGeomColl.GeometryCount > 0)
            {
                ITopologicalOperator theTopoOp = null;

                switch (a_Dimensionality)
                {
                    case 0:
                        if (multipart)
                        {
                            theTopoOp = new MultipointClass();
                            theTopoOp.ConstructUnion((IEnumGeometry)theGeomColl);
                        }
                        else
                            theTopoOp = theGeomColl.get_Geometry(0) as ITopologicalOperator;
                        break;
                    case 1:
                        theTopoOp = new PolylineClass();
                        theTopoOp.ConstructUnion((IEnumGeometry)theGeomColl);
                        break;
                    case 2:
                        theTopoOp = new PolygonClass();
                        theTopoOp.ConstructUnion((IEnumGeometry)theGeomColl);
                        break;
                }

                theReturn = theTopoOp as IGeometry;
            }
            return theReturn;
        }
示例#53
0
        public static void MakeHatchs(IPolyline pPL, bool Ends, IPolyline pMajor, IPolyline pMinor)
        {
            ITopologicalOperator pTopo = pPL as ITopologicalOperator;
            pTopo.Simplify();
            ISegmentCollection pSCMajor = pMajor as ISegmentCollection;
            ISegmentCollection pSCMinor = pMinor as ISegmentCollection;

            IGeometryCollection pGC = pPL as IGeometryCollection;
            IPath pPath;
            IGeometryCollection pSubPL;
            IMSegmentation pPLM;
            object missing = Type.Missing;
            IMAware pMAware;
            double Mmin;
            double Mmax;
            int cnt = pGC.GeometryCount - 1;
            for (int i = 0; i <= cnt - 1; i++)
            {
                pPath = pGC.get_Geometry(i) as IPath;
                pSubPL = new PolylineClass();
                pSubPL.AddGeometry(pPath as IGeometry, ref missing, ref missing);
                pMAware = pSubPL as IMAware;
                pMAware.MAware = true;
                pPLM = pSubPL as IMSegmentation;
                Mmin = pPLM.MMin;
                Mmax = pPLM.MMax;

            }
        }
示例#54
0
        public static void MakeHatchesEndsOnly(IPolyline pPL, bool Ends, IPolyline pMajor, IPolyline pMinor, double dHatchLen, double dTxtInterval, double dHatchOffset)
        {
            //���������
            ITopologicalOperator pTopo = pPL as ITopologicalOperator;
            pTopo.Simplify();
            //���ǽ��ڶμ����д洢HATCH
            ISegmentCollection pSCMajor = pMajor as ISegmentCollection;
            ISegmentCollection pSCMinor = pMinor as ISegmentCollection;

            //Break the polyline into parts here ... Ideally, there should be one part
            //per route. In cases where there is mSEETARD than one part, and there is no physical
            // separation in the parts, the results can look like they are wrong (i.e. there
            //appears to be text where there should not be).
            IGeometryCollection pGC = pPL as IGeometryCollection;
            int cnt = pGC.GeometryCount - 1;
            object missing = Type.Missing;
            object distances;
            double dist;
            for (int i = 0; i <= pGC.GeometryCount - 1; i++)
            {
                IPath pPath = pGC.get_Geometry(i) as IPath;
                IGeometryCollection pSubPL = new PolylineClass();
                pSubPL.AddGeometry(pPath, ref missing, ref missing);
                IMAware pMAware = pSubPL as IMAware;
                pMAware.MAware = true;
                IMSegmentation pPLM = pSubPL as IMSegmentation;
                double Mmin = pPLM.MMin;
                double Mmax = pPLM.MMax;
                ISegment pSeg = MakeOneHatch(pSubPL as IPolyline, Mmin, Mmin, 1, dTxtInterval, dHatchLen, dHatchOffset);
                if (pSeg.Length >= ((Math.Abs(dHatchLen) * 0.5) + 0.001))
                    pSCMajor.AddSegment(pSeg, ref  missing, ref missing);
                else
                    pSCMinor.AddSegment(pSeg, ref missing, ref missing);
                distances = pPLM.GetDistancesAtM(false, Mmax);
                IArray pArray = (IArray)distances;
                for (int j = 0; j <= pArray.Count - 1; j++)
                {
                    dist = (double)pArray.get_Element(j);
                    pSeg = MakeOneHatch(pSubPL as IPolyline, dist, Mmax, 1, dTxtInterval, dHatchLen, dHatchOffset);
                    if (pSeg.Length >= (Math.Abs(dHatchLen) * 0.5) + 0.001)
                    {
                        pSCMajor.AddSegment(pSeg, ref missing, ref missing);
                    }
                    else
                    {
                        pSCMinor.AddSegment(pSeg, ref missing, ref missing);
                    }
                }
            }
            pMajor.SimplifyNetwork();
            pMinor.SimplifyNetwork();
        }
        public static void WriteTurnGeometry(string outputFileGdbPath, string StreetsFCName, string TurnFCName,
                                             int numAltIDFields, double trimRatio, IGPMessages messages, ITrackCancel trackcancel)
        {
            messages.AddMessage("Writing turn geometries...");

            // Open the feature classes in the file geodatabase

            Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory");
            var wsf = Activator.CreateInstance(factoryType) as IWorkspaceFactory;
            var fws = wsf.OpenFromFile(outputFileGdbPath, 0) as IFeatureWorkspace;
            IFeatureClass streetsFC = fws.OpenFeatureClass(StreetsFCName);
            IFeatureClass turnFC = fws.OpenFeatureClass(TurnFCName);

            // Look up the Edge1End, EdgeFCID and EdgeFID fields on the turn feature class

            int edge1EndField = turnFC.FindField("Edge1End");
            int[] edgeFCIDFields = new int[numAltIDFields];
            int[] edgeFIDFields = new int[numAltIDFields];
            for (int i = 0; i < numAltIDFields; i++)
            {
                edgeFCIDFields[i] = turnFC.FindField("Edge" + (i + 1) + "FCID");
                edgeFIDFields[i] = turnFC.FindField("Edge" + (i + 1) + "FID");
            }

            // Look up the FCID of the Streets feature class and open a random access cursor on it

            int streetsFCID = streetsFC.FeatureClassID;
            IRandomAccessCursor rac = (streetsFC as IRandomAccessTable).GetRandomRows("", true);

            // Create an update cursor on the turn feature class

            var qf = new QueryFilterClass() as IQueryFilter;
            IFeatureCursor featCursor = turnFC.Update(qf, false);
            IFeature turnFeat = null;
            int numFeatures = 0;
            double lastCurveLength = 0.0;
            while ((turnFeat = featCursor.NextFeature()) != null)
            {
                // Get the geometry of the first line in the turn, rotate and trim it
                var lineFeat = rac.GetRow((int)turnFeat.get_Value(edgeFIDFields[0])) as IFeature;
                var featCurve = lineFeat.ShapeCopy as ICurve;
                ICurve workingCurve = null;
                switch ((string)turnFeat.get_Value(edge1EndField))
                {
                    case "Y":
                        featCurve.GetSubcurve(1.0 - trimRatio, 1.0, true, out workingCurve);
                        break;
                    case "N":
                        featCurve.GetSubcurve(0.0, trimRatio, true, out workingCurve);
                        workingCurve.ReverseOrientation();
                        break;
                    default:
                        messages.AddWarning("ERROR: Invalid Edge1End value!  Turn OID: " + turnFeat.OID);
                        break;
                }
                if (workingCurve == null)
                {
                    continue;
                }

                // Create a new polyline and add the trimmed first line to it
                var segColl = new PolylineClass() as ISegmentCollection;
                segColl.AddSegmentCollection(workingCurve as ISegmentCollection);

                // Remember the last point of the curve
                IPoint lastCurveEnd = workingCurve.ToPoint;

                bool earlyExit = false;
                for (int i = 1; i < numAltIDFields; i++)
                {
                    if ((int)turnFeat.get_Value(edgeFCIDFields[i]) != streetsFCID)
                    {
                        // This was the last part of the turn -- break out and finalize the geometry
                        break;
                    }

                    // Otherwise get the geometry of this line in the turn, rotate it if necessary,
                    // and add it to the segment collection
                    lineFeat = rac.GetRow((int)turnFeat.get_Value(edgeFIDFields[i])) as IFeature;
                    var poly = lineFeat.ShapeCopy as IPolycurve;
                    bool splitHappened;
                    int newPart, newSeg;
                    poly.SplitAtDistance(0.5, true, false, out splitHappened, out newPart, out newSeg);
                    featCurve = poly as ICurve;
                    IPoint myPoint = featCurve.FromPoint;
                    if (EqualPoints(myPoint, lastCurveEnd))
                    {
                        segColl.AddSegmentCollection(featCurve as ISegmentCollection);
                    }
                    else
                    {
                        myPoint = featCurve.ToPoint;
                        if (EqualPoints(myPoint, lastCurveEnd))
                        {
                            featCurve.ReverseOrientation();
                            segColl.AddSegmentCollection(featCurve as ISegmentCollection);
                        }
                        else
                        {
                            messages.AddWarning("ERROR: Edge " + (i+1) + " is discontinuous with the previous curve!  Turn OID: " + turnFeat.OID);
                            earlyExit = true;
                            break;
                        }
                    }

                    // Remember the length of the last curve added, and the last point of the curve
                    lastCurveLength = featCurve.Length;
                    lastCurveEnd = featCurve.ToPoint;
                }
                // If the edges of the turn were read in successfully...
                if (!earlyExit)
                {
                    // Trim the segment such that the last curve is the length of the trim ratio
                    workingCurve = segColl as ICurve;
                    workingCurve.GetSubcurve(0.0, workingCurve.Length - ((1.0 - trimRatio) * lastCurveLength), false, out featCurve);
                    turnFeat.Shape = featCurve as IGeometry;

                    // Write out the turn geometry and increment the count
                    featCursor.UpdateFeature(turnFeat);
                    numFeatures++;

                    if ((numFeatures % 100) == 0)
                    {
                        // check for user cancel

                        if (trackcancel != null && !trackcancel.Continue())
                            throw (new COMException("Function cancelled."));
                    }
                }
            }
        }
示例#56
0
        private List<IGeometry> StripArea(IGeometry geom, double height, bool direction)
        {
            //把一块图形划分为条状. direction为true时, 上部为规整的边, 否则下部为规整的边.
            List<IGeometry> stripedAreaList = new List<IGeometry>();
            IPolyline stripLine = new PolylineClass();
            IPointCollection ptCol = stripLine as IPointCollection;
            IPoint startPt, endPt; //startPt一定在endPt的左边.
            IGeometry cutedGeom = geom;
            ITopologicalOperator tpOp;
            IRelationalOperator reOp;
            if (direction)
            {
                startPt = geom.Envelope.UpperLeft;
                endPt = geom.Envelope.UpperRight;
            }
            else
            {
                startPt = geom.Envelope.LowerLeft;
                endPt = geom.Envelope.LowerRight;
                height = -1 * height;
            }
            startPt.Y -= height;
            endPt.Y -= height;
            ptCol.AddPoint(startPt);
            ptCol.AddPoint(endPt);
            tpOp = cutedGeom as ITopologicalOperator;
            reOp = cutedGeom as IRelationalOperator;
            while (reOp.Crosses(stripLine) || reOp.Contains(stripLine))
            {
                IGeometry tempGeom;
                if (direction)
                {
                    tpOp.Cut(stripLine, out tempGeom, out cutedGeom);
                }
                else
                {
                    tpOp.Cut(stripLine, out cutedGeom, out tempGeom);
                }
                stripedAreaList.Add(tempGeom);
                startPt.Y -= height;
                endPt.Y -= height;
                stripLine = new PolylineClass();
                ptCol = stripLine as IPointCollection;
                ptCol.AddPoint(startPt);
                ptCol.AddPoint(endPt);
                tpOp = cutedGeom as ITopologicalOperator;
                reOp = cutedGeom as IRelationalOperator;
            }

            return stripedAreaList;
        }
        public static returnFeatArray ConnectClosestFeature(IApplication app, List<ConnectClosestDetails> connectClosestLayers, bool logOperation, bool suppressDialog, string LayerName)
        {
            bool bUseTemplate;
            bool bSelectedOnly;
            if (Control.ModifierKeys == Keys.Shift)
            {

                bSelectedOnly = true;
                bUseTemplate = true;

            }
            else if (Control.ModifierKeys == (Keys.Control | Keys.Shift))
            {
                bSelectedOnly = true;
                bUseTemplate = false;

            }
            else if (Control.ModifierKeys == Keys.Control)
            {
                bSelectedOnly = false;
                bUseTemplate = false;

            }
            else
            {

                bSelectedOnly = false;
                bUseTemplate = true;
            }

            //ProgressBar
            ESRI.ArcGIS.Framework.IProgressDialogFactory progressDialogFactory = null;
            ESRI.ArcGIS.esriSystem.IStepProgressor stepProgressor = null;
            ESRI.ArcGIS.Framework.IProgressDialog2 progressDialog = null;
            // Create a CancelTracker
            ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel = null;

            List<IFeature> pRetFeature = new List<IFeature>();
            IEditor editor = null;
            IMouseCursor appCursor = null;
            IMxDocument mxdoc = null;
            IMap map = null;
            IFeatureLayer pTargetLayer = null;
            IFeatureLayer pointFLayer = null;
            IFeatureLayer connectLineFLayer = null;
            ICursor pointCursor = null;
            IFeature pointFeature = null;

            IEditTemplate pEditTemp = null;
            IFeatureSelection pointFeatureSelection = null;
            IGeometry pNearestFeature = null;
            ISelectionSet2 sel = null;
            IPolyline pNewPoly = null;
            IFeature pLine = null;
            IEditLayers eLayers = null;
            returnFeatArray retVal = new returnFeatArray();
            try
            {
                //Get edit session
                trackCancel = new ESRI.ArcGIS.Display.CancelTrackerClass();
                editor = Globals.getEditor(app);
                if (editor == null)
                    return null;

                if (editor.EditState != esriEditState.esriStateEditing)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("MustBEditg"), _caption);
                    //_editor = null;

                    return null;
                }

                //Change mouse cursor to wait - automatically changes back (ArcGIS Desktop only)
                appCursor = new MouseCursorClass();
                appCursor.SetCursor(2);

                mxdoc = (IMxDocument)app.Document;
                map = mxdoc.FocusMap;

                //Find required layers
                if (connectClosestLayers == null)
                    return null;
                if (connectClosestLayers.Count == 0)
                    return null;

                // Set the properties of the Step Progressor
                System.Int32 int32_hWnd = app.hWnd;
                if (suppressDialog == false)
                {
                    progressDialogFactory = new ESRI.ArcGIS.Framework.ProgressDialogFactoryClass();
                    stepProgressor = progressDialogFactory.Create(trackCancel, int32_hWnd);

                    stepProgressor.StepValue = 1;
                    stepProgressor.Message = _caption;
                    // Create the ProgressDialog. This automatically displays the dialog
                    progressDialog = (ESRI.ArcGIS.Framework.IProgressDialog2)stepProgressor; // Explict Cast

                    // Set the properties of the ProgressDialog
                    progressDialog.CancelEnabled = true;
                    progressDialog.Title = _caption;
                    progressDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressGlobe;
                    progressDialog.ShowDialog();

                }
                // Create an edit operation enabling undo/redo

                bool FCorLayerTarget = true;
                if (LayerName != "")
                {
                    pTargetLayer = Globals.FindLayer(map, LayerName, ref  FCorLayerTarget) as IFeatureLayer;

                }

                for (int k = 0; k < connectClosestLayers.Count; k++)
                {
                    bool FCorLayerPoint = true;
                    bool FCorLayerConnect = true;
                    //int currentLayerSub;
                    pointFLayer = Globals.FindLayer(map, (connectClosestLayers[k] as ConnectClosestDetails).Point_Layer, ref FCorLayerPoint) as IFeatureLayer;
                    connectLineFLayer = Globals.FindLayer(map, (connectClosestLayers[k] as ConnectClosestDetails).Line_Layer, ref FCorLayerConnect) as IFeatureLayer;

                    //Report any problems before exiting
                    if (pointFLayer == null)
                    {
                        //MessageBox.Show("Layer representing connection points was not found.  Configuration indicated feature class name: '" + _pointLayerName + "'.", _caption);
                        //return;
                        continue;
                    }
                    if (connectLineFLayer == null)
                    {
                        //MessageBox.Show("Layer representing connect was not found.  Configuration indicated feature class name: '" + _connectLineLayerName + "'.", _caption);
                        //return;
                        continue;
                    }
                    if (pTargetLayer != null)
                    {
                        if (pTargetLayer.FeatureClass.CLSID.Value.ToString() != pointFLayer.FeatureClass.CLSID.Value.ToString())

                        { continue; }
                    }

                    //Verify that some points are selected

                    pointFeatureSelection = (IFeatureSelection)pointFLayer;
                    if (pointFeatureSelection.SelectionSet.Count == 0)
                        continue;

                    //Confirm that target layer is editable and is a line layer
                    eLayers = (IEditLayers)editor;
                    if (!(eLayers.IsEditable(connectLineFLayer)) || (connectLineFLayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline))
                        continue;

                    //Confirm the other layers are the correct shape type
                    if (pointFLayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint)
                        continue;
                    if (suppressDialog == false)
                    {
                        stepProgressor.MinRange = 0;
                        stepProgressor.MaxRange = connectClosestLayers.Count;
                        progressDialog.Title = (connectClosestLayers[k] as ConnectClosestDetails).Line_Layer;
                        stepProgressor.Message = (connectClosestLayers[k] as ConnectClosestDetails).Line_Layer;
                        progressDialog.Description = A4LGSharedFunctions.Localizer.GetString("ConnectAsset") + "1" + A4LGSharedFunctions.Localizer.GetString("Of") + pointFeatureSelection.SelectionSet.Count + ".";
                    }

                    int total = pointFeatureSelection.SelectionSet.Count;
                    int i = 0;

                    try
                    {

                        if (logOperation)
                        {
                            try
                            {
                                editor.StartOperation();
                            }
                            catch
                            {
                                logOperation = false;
                            }

                        }

                        if (bUseTemplate)
                        {
                            pEditTemp = Globals.PromptAndGetEditTemplateGraphic(connectLineFLayer, connectClosestLayers[k].Line_EditTemplate);
                            //pEditTemp = Globals.PromptAndGetEditTemplate(app, connectLineFLayer, connectClosestLayers[k].Line_EditTemplate);
                        }
                        else
                        {
                            //pEditTemp = Globals.PromptAndGetEditTemplate(app, connectLineFLayer, "");
                            pEditTemp = Globals.PromptAndGetEditTemplateGraphic(connectLineFLayer, "");
                        }

                        sel = pointFeatureSelection.SelectionSet as ISelectionSet2;
                        //sel.Update(null, false, out pointCursor);
                        sel.Search(null, false, out pointCursor);
                        while ((pointFeature = (IFeature)pointCursor.NextRow()) != null)
                        {
                            i += 1;
                            if (suppressDialog == false)
                            {
                                //Update progress bar
                                progressDialog.Description = A4LGSharedFunctions.Localizer.GetString("ConnectAsset") + i.ToString() + A4LGSharedFunctions.Localizer.GetString("Of") + total.ToString() + "." + Environment.NewLine +
                                  A4LGSharedFunctions.Localizer.GetString("CurrentOID") + pointFeature.OID;
                                stepProgressor.Step();
                            }
                            ESRI.ArcGIS.esriSystem.IStatusBar statusBar = app.StatusBar;
                            statusBar.set_Message(0, i.ToString());

                            //Check if the cancel button was pressed. If so, stop process
                            bool boolean_Continue = trackCancel.Continue();
                            if (!boolean_Continue)
                            {
                                break;
                            }

                            //IFeature pNearestFeature =
                            pNearestFeature = Globals.GetClosestFeatureIgnoreExistingLineFeature((connectClosestLayers[k] as ConnectClosestDetails).Search_Threshold,
                                                                             pointFeature.ShapeCopy, pointFLayer, connectLineFLayer, bSelectedOnly);

                            if (pNearestFeature == null)
                                break;

                            pNewPoly = new PolylineClass();
                            pNewPoly.FromPoint = pNearestFeature as IPoint;
                            pNewPoly.ToPoint = pointFeature.ShapeCopy as IPoint;

                            if (pEditTemp == null)
                            {
                                pLine = Globals.CreateFeature(pNewPoly, connectLineFLayer, editor, app, false, false, true);
                            }
                            else
                            {
                                pLine = Globals.CreateFeature(pNewPoly, pEditTemp, editor, app, false, false, true);
                            }
                            pLine.Store();
                            pRetFeature.Add(pLine);

                        }
                        if ((connectClosestLayers[k] as ConnectClosestDetails).Reset_Flow != null)
                        {
                            if ((connectClosestLayers[k] as ConnectClosestDetails).Reset_Flow.ToUpper() == "DIGITIZED")
                            {
                                retVal.Options = "DIGITIZED";

                            }
                            else if ((connectClosestLayers[k] as ConnectClosestDetails).Reset_Flow.ToUpper() == "ROLE")
                            {
                                retVal.Options = "ROLE";

                            }
                            else if ((connectClosestLayers[k] as ConnectClosestDetails).Reset_Flow.ToUpper() == "Ancillary".ToUpper())
                            {
                                retVal.Options = "ANCILLARY";

                            }
                            else
                            {
                            }

                        }

                        if (logOperation)
                        {
                            try
                            {
                                // Stop the edit operation
                                editor.StopOperation((connectClosestLayers[k] as ConnectClosestDetails).Point_Layer);

                            }
                            catch
                            {
                                logOperation = false;
                            }

                        }

                    }

                    catch (Exception ex)
                    {
                        editor.AbortOperation();
                        MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + "ConnectClosestFeature\n" + ex.Message, ex.Source);

                        // Cleanup
                        if (progressDialog != null)
                            progressDialog.HideDialog();
                        return null;
                    }

                }
                (map as IActiveView).Refresh();
                retVal.Features = pRetFeature;
                return retVal;
            }

            catch (Exception ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + "ConnectClosestFeature\n" + ex.Message, A4LGSharedFunctions.Localizer.GetString("ConstructionToolsLbl_1"));
                return null;
            }
            finally
            {// Cleanup
                if (progressDialog != null)
                    progressDialog.HideDialog();
                if (pointCursor != null)
                    Marshal.ReleaseComObject(pointCursor);
                progressDialogFactory = null;
                stepProgressor = null;
                progressDialog = null;
                trackCancel = null;

                pRetFeature = null;
                editor = null;
                appCursor = null;
                mxdoc = null;
                map = null;
                pTargetLayer = null;
                pointFLayer = null;
                connectLineFLayer = null;
                pointCursor = null;
                pointFeature = null;

                pEditTemp = null;
                pointFeatureSelection = null;
                pNearestFeature = null;
                sel = null;
                pNewPoly = null;
                pLine = null;
                eLayers = null;

            }
        }
示例#58
0
        //�������ĸ߳�����
        public static void ProfileGetRelatedSewerElevData(AxMapControl ppAxMapControl, IGeometricNetwork pGeoNetwork, IEnumNetEID pResultEdges, IEnumNetEID pResultJunctions)
        {
            try
            {
                //��ñ������Զ�Ӧ������׷�ٽ��
                IArray pSewerElevArray = new ArrayClass();
                IEIDHelper pEIDHelper = new EIDHelperClass();
                pEIDHelper.GeometricNetwork = pGeoNetwork;
                pEIDHelper.ReturnFeatures = true;
                pEIDHelper.ReturnGeometries = true;
                pEIDHelper.PartialComplexEdgeGeometry = true;
                pEIDHelper.AddField("Component_Key2");
                IEnumEIDInfo pEnumEIDInfo = pEIDHelper.CreateEnumEIDInfo(pResultEdges);
                //�������߻�����ص������߼�¼
                pEnumEIDInfo.Reset();
                IEIDInfo pEIDInfo = pEnumEIDInfo.Next();
                IFeature pFeature = pEIDInfo.Feature;
                IGeometry pFeatGeo = pEIDInfo.Geometry;
                //�������л�ù�ϵ
                IEnumRelationshipClass pEnumRelationshipCls = pFeature.Class.get_RelationshipClasses(esriRelRole.esriRelRoleOrigin);
                pEnumRelationshipCls.Reset();
                IRelationshipClass pRelationshipCls = pEnumRelationshipCls.Next();
                //�����ȷ�Ĺ�ϵ��
                string s = "SewerToMainline";
                while (pRelationshipCls != null)
                {
                    if (pRelationshipCls.ForwardPathLabel.ToUpper() == s.ToUpper())
                        break;
                    else
                        pRelationshipCls = pEnumRelationshipCls.Next();
                }
                //��ѯ���ɹ�����ÿ������ص����ݣ������1-1�Ĺ�ϵ����ֻ����һ����¼
                //  because the arcs are ordered and directional, if the start node is an
                //  fnode then get subsequent tnode's for the rest of the arcs, else if the
                //  start node is a tnode, get subsequent fnode's.  Related data has elev
                //  attributes for up and down stream manhole elevs, so related to from and to node of arc.
                // get the first junction in the network trace results to determine if the
                //first junction is a from-node or a to-node for graphing sewer line elev
                if (pRelationshipCls != null)
                {
                    ISet pMainlineRelatedSet;
                    IRow pMainlineRow;
                    IEIDHelper pEIDHelper2 = new EIDHelperClass();
                    pEIDHelper2.GeometricNetwork = pGeoNetwork;
                    pEIDHelper2.ReturnFeatures = true;
                    pEIDHelper2.ReturnGeometries = true;
                    pEIDHelper2.PartialComplexEdgeGeometry = true;
                    IEnumEIDInfo pEnumEIDInfo2 = pEIDHelper2.CreateEnumEIDInfo(pResultJunctions);
                    pEnumEIDInfo2.Reset();
                    //pFeature is the first arc in the network trace results
                    // check the junctions on the first arc to see which is the starting
                    // junction, this determines which sewer elev attribute (ups_elev, dwn_elev)
                    // will be used to calculate the sewer line profile
                    IEdgeFeature pEdgeFeat = pFeature as IEdgeFeature;
                    string strStartAttr;
                    string strMHelevAttr;
                    double lastelev = 0;
                    int lastnodeEID;
                    if (pEnumEIDInfo2.Next().EID == pEdgeFeat.FromJunctionEID)
                    {
                        // trace is in the direction of flow, flow goes down hill
                        strStartAttr = "Ups_elev";
                        strMHelevAttr = "Dwn_elev";
                    }
                    else
                    {
                        //trace is in the opposite direction of flow, flow goes up hill
                        strStartAttr = "Dwn_elev";
                        strMHelevAttr = "Ups_elev";
                    }
                    lastnodeEID = pEnumEIDInfo2.Next().EID;
                    // create a polyline from the result junctions, make the polyline in the
                    //direction of the trace, not in the direction of the original arcs/edges
                    IPolyline pPolyline = new PolylineClass();
                    IPointCollection pPointColl = pPolyline as IPointCollection;
                    pEnumEIDInfo2.Reset();
                    object missing = Type.Missing;
                    for (int i = 0; i <= pEnumEIDInfo2.Count - 1; i++)
                    {
                        pPointColl.AddPoint(pEnumEIDInfo2.Next().Geometry as IPoint, ref missing, ref missing);
                    }
                    ISegmentCollection pSegColl = pPolyline as ISegmentCollection;
                    //�򻯶����
                    ITopologicalOperator pTopoOp = pPolyline as ITopologicalOperator;
                    pTopoOp.Simplify();
                    pPolyline.SimplifyNetwork();
                    pPolyline.Densify(50, 0.01);
                    pResultEdges.Reset();
                    pEnumEIDInfo2.Reset();
                    IPolyline pNewSegPolyline;
                    IPolyline pPolyLineFeat;
                    IRelationalOperator pRelOpFeat;
                    ISegmentCollection pNewSegColl;
                    ISegmentCollection pSegmentColl = pPolyline as ISegmentCollection;
                    for (int i = 0; i <= pResultEdges.Count - 1; i++)
                    {
                        pMainlineRelatedSet = pRelationshipCls.GetObjectsRelatedToObject(pFeature);
                        pMainlineRelatedSet.Reset();
                        pMainlineRow = pMainlineRelatedSet.Next() as IRow;
                        pPolyLineFeat = pFeature.Shape as IPolyline;
                        pRelOpFeat = pPolyLineFeat as IRelationalOperator;
                        for (int j = 0; j <= pSegmentColl.SegmentCount - 1; j++)
                        {
                            pNewSegPolyline = new PolylineClass();
                            pNewSegColl = pNewSegPolyline as ISegmentCollection;
                            pNewSegColl.AddSegment(pSegmentColl.get_Segment(j), ref missing, ref missing);
                            if (pRelOpFeat.Contains(pNewSegPolyline as IGeometry))
                            {
                                if (j == 0)
                                {
                                    pSewerElevArray.Add(pMainlineRow.get_Value(pMainlineRow.Fields.FindField(strStartAttr)));
                                    lastelev = Convert.ToDouble(pMainlineRow.get_Value(pMainlineRow.Fields.FindField(strMHelevAttr)));
                                }
                                else
                                {
                                    if (lastelev == Convert.ToDouble(pMainlineRow.get_Value(pMainlineRow.Fields.FindField(strMHelevAttr))))
                                    {
                                        pSewerElevArray.Add(-99);
                                    }
                                    else
                                    {
                                        pSewerElevArray.Add(lastelev);
                                        lastelev = Convert.ToDouble(pMainlineRow.get_Value(pMainlineRow.Fields.FindField(strMHelevAttr)));
                                    }
                                }
                            }
                        }
                        // get the next feature and check to see what direction it's going and
                        //adjust the variables accordingly
                        if (i < pResultEdges.Count - 1)
                        {
                            lastnodeEID = pEdgeFeat.ToJunctionEID;
                            pFeature = pEnumEIDInfo.Next().Feature;
                            pEdgeFeat = pFeature as IEdgeFeature;
                            if (pEdgeFeat.FromJunctionEID == lastnodeEID)
                                strMHelevAttr = "Dwn_elev";
                            else
                                strMHelevAttr = "Ups_elev";

                        }
                        else
                        {
                            pSewerElevArray.Add(pMainlineRow.get_Value(pMainlineRow.Fields.FindField(strMHelevAttr)));

                        }
                    }
                    ProfileCreateGraph(ppAxMapControl, pPolyline, pSewerElevArray);
                }
            }
            catch (Exception eX)
            {
                MessageBox.Show(eX.Message);

            }
        }
        public static returnFeatArray ConnectClosestFeatureAtPoint(IApplication app, List<ConnectClosestDetails> connectClosestLayers, IPoint location, string LayerName, bool logOperation, Keys mod)
        {
            bool bSelectedOnly;
            bool bUseTemplate;
            if (mod == Keys.Shift)
            {

                bSelectedOnly = true;
                bUseTemplate = true;

            }
            else if (mod == (Keys.Control | Keys.Shift))
            {
                bSelectedOnly = true;
                bUseTemplate = false;

            }
            else if (mod == Keys.Control)
            {
                bSelectedOnly = false;
                bUseTemplate = false;

            }
            else
            {

                bSelectedOnly = false;
                bUseTemplate = true;
            }
            List<IFeature> pRetFeature = null;
            IEditor editor = null;
            IMouseCursor appCursor = null;
            IMxDocument mxdoc = null;
            IMap map = null;
            IFeatureLayer pTargetLayer = null;
            IEditLayers eLayers = null;
            IFeatureLayer pointFLayer = null;
            IFeatureLayer connectLineFLayer = null;
            IEditTemplate pEditTemp = null;
            IGeometry pNearestFeature = null;
            IPolyline pNewPoly = null;
            IFeature pLine = null;
            returnFeatArray retVal = new returnFeatArray();
            try
            {
                pRetFeature = new List<IFeature>();
                //Get edit session
                editor = Globals.getEditor(app);

                if (editor == null)
                    return null;

                if (editor.EditState != esriEditState.esriStateEditing)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("MustBEditg"), _caption);
                    //editor = null;

                    return null;
                }

                //Change mouse cursor to wait - automatically changes back (ArcGIS Desktop only)
                appCursor = new MouseCursorClass();
                appCursor.SetCursor(2);

                app = editor.Parent;
                mxdoc = (IMxDocument)app.Document;
                map = editor.Map;

                //Find required layers
                if (connectClosestLayers == null)
                    return null;
                if (connectClosestLayers.Count == 0)
                    return null;

                // Set the properties of the Step Progressor
                System.Int32 int32_hWnd = app.hWnd;

                if (logOperation)
                {
                    try
                    {
                        editor.StartOperation();
                    }
                    catch
                    {
                        logOperation = false;
                    }

                }
                pTargetLayer = null;
                bool FCorLayerTarget = true;
                if (LayerName != "")
                {
                    pTargetLayer = Globals.FindLayer(map, LayerName, ref FCorLayerTarget) as IFeatureLayer;

                }

                for (int k = 0; k < connectClosestLayers.Count; k++)
                {
                    if (pTargetLayer.Name.ToString() != (connectClosestLayers[k] as ConnectClosestDetails).Point_Layer)
                    { continue; }

                    // int currentLayerSub;
                    bool FCorLayerPoint = true;
                    bool FCorLayerConnect = true;
                    pointFLayer = Globals.FindLayer(map, (connectClosestLayers[k] as ConnectClosestDetails).Point_Layer, ref FCorLayerPoint) as IFeatureLayer;
                    connectLineFLayer = Globals.FindLayer(map, (connectClosestLayers[k] as ConnectClosestDetails).Line_Layer, ref FCorLayerConnect) as IFeatureLayer;

                    //Report any problems before exiting
                    if (pointFLayer == null)
                    {
                        //MessageBox.Show("Layer representing connection points was not found.  Configuration indicated feature class name: '" + _pointLayerName + "'.", this._caption);
                        //return;
                        continue;
                    }
                    if (connectLineFLayer == null)
                    {
                        //MessageBox.Show("Layer representing connect was not found.  Configuration indicated feature class name: '" + _connectLineLayerName + "'.", this._caption);
                        //return;
                        continue;
                    }
                    if (pTargetLayer != null)
                    {
                        if (pTargetLayer.FeatureClass.CLSID.Value.ToString() != pointFLayer.FeatureClass.CLSID.Value.ToString())

                        { continue; }

                    }

                    //Confirm that target layer is editable and is a line layer
                    eLayers = (IEditLayers)editor;
                    if (!(eLayers.IsEditable(connectLineFLayer)) || (connectLineFLayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline))
                        continue;

                    //Confirm the other layers are the correct shape type
                    if (pointFLayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint)
                        continue;

                    try
                    {

                        if (bUseTemplate)
                        {
                            //pEditTemp = Globals.PromptAndGetEditTemplate(app, connectLineFLayer, (connectClosestLayers[k] as ConnectClosestDetails).Line_EditTemplate);
                            pEditTemp = Globals.PromptAndGetEditTemplateGraphic(connectLineFLayer, (connectClosestLayers[k] as ConnectClosestDetails).Line_EditTemplate);
                        }
                        else
                        {
                            //pEditTemp = Globals.PromptAndGetEditTemplate(app, connectLineFLayer, "");
                            pEditTemp = Globals.PromptAndGetEditTemplateGraphic(connectLineFLayer, "");
                        }

                        pNearestFeature = Globals.GetClosestFeatureIgnoreExistingLineFeature((connectClosestLayers[k] as ConnectClosestDetails).Search_Threshold,
                                                                        location, pointFLayer, connectLineFLayer, bSelectedOnly);

                        if (pNearestFeature == null)
                            break;

                        pNewPoly = new PolylineClass();
                        pNewPoly.FromPoint = pNearestFeature as IPoint;
                        pNewPoly.ToPoint = location as IPoint;

                        if (pEditTemp == null)
                        {
                            pLine = Globals.CreateFeature(pNewPoly, connectLineFLayer, editor, app, false, false, true);
                        }
                        else
                        {
                            pLine = Globals.CreateFeature(pNewPoly, pEditTemp, editor, app, false, false, true);
                        }
                        pLine.Store();
                        pRetFeature.Add(pLine);

                        if ((connectClosestLayers[k] as ConnectClosestDetails).Reset_Flow != null)
                        {
                            if ((connectClosestLayers[k] as ConnectClosestDetails).Reset_Flow.ToUpper() == "DIGITIZED")
                            {
                                retVal.Options = "DIGITIZED";

                            }
                            else if ((connectClosestLayers[k] as ConnectClosestDetails).Reset_Flow.ToUpper() == "ROLE")
                            {
                                retVal.Options = "ROLE";

                            }
                            else if ((connectClosestLayers[k] as ConnectClosestDetails).Reset_Flow.ToUpper() == "Ancillary".ToUpper())
                            {
                                retVal.Options = "Ancillary".ToUpper();

                            }
                            else
                            {
                            }

                        }

                    }

                    catch (Exception ex)
                    {
                        editor.AbortOperation();
                        MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + "ConnectClosestFeatureAtPoint\n" + ex.Message, ex.Source);

                    }

                    if (logOperation)
                    {
                        try
                        {
                            // Stop the edit operation
                            editor.StopOperation(_caption);

                        }
                        catch
                        {
                            logOperation = false;
                        }

                    }
                }
                (map as IActiveView).Refresh();
                retVal.Features = pRetFeature;
                return retVal;
            }

            catch (Exception ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + "ConnectClosestFeatureAtPoint\n" + ex.Message, A4LGSharedFunctions.Localizer.GetString("ConstructionToolsLbl_1"));
                return null;
            }
            finally
            {
                pRetFeature = null;
                editor = null;
                appCursor = null;
                mxdoc = null;
                map = null;
                pTargetLayer = null;
                eLayers = null;
                pointFLayer = null;
                connectLineFLayer = null;
                pEditTemp = null;
                pNearestFeature = null;
                pNewPoly = null;
                pLine = null;
            }
        }
        public bool SetDynamicValues(IObject inObject, string mode, out List<IObject> ChangeFeatureList, out List<IObject> NewFeatureList, out List<IObject> ChangeFeatureGeoList)
        {
            NumberFormatInfo nfi = new CultureInfo(A4LGSharedFunctions.Localizer.GetString("AA_CultureInfo"), false).NumberFormat;
            nfi.NumberGroupSeparator = "";

            ChangeFeatureList = null;
            NewFeatureList = null;
            ChangeFeatureGeoList = null;

            IMSegmentation mseg = null;
            INetworkFeature netFeat = null;

            IJunctionFeature iJuncFeat = null;
            IEdgeFeature iEdgeFeat = null;

            //ProgressBar
            //ESRI.ArcGIS.Framework.IProgressDialogFactory progressDialogFactory = null;
            //ESRI.ArcGIS.esriSystem.IStepProgressor stepProgressor = null;
            //ESRI.ArcGIS.Framework.IProgressDialog2 progressDialog = null;
            //// Create a CancelTracker
            //ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel = new ESRI.ArcGIS.Display.CancelTrackerClass();
            //trackCancel.CancelOnKeyPress = true;
            // trackCancel.CancelOnClick = true;

            try
            {
                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14d"));
                if (AAState.PerformUpdates == false)
                {
                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14a"));

                }
                if (AAState.PerformUpdates && AAState._dv == null)
                {

                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14b") + AAState._defaultsTableName);

                    AAState.PerformUpdates = false;
                    return false;
                }

                if (AAState.PerformUpdates && AAState._dv != null)
                {
                    if (AAState._dv.Table == null)
                    {

                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14c"));

                        return false;
                    }

                    if (inObject == null)
                    {
                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14e"));

                        return false;
                    }
                    if (inObject.Table == AAState._tab)
                    {

                        if (inObject.get_Value(inObject.Fields.FindField("VALUEMETHOD")).ToString().ToUpper() == "LAST_VALUE")
                        {
                            if (inObject.get_Value(inObject.Fields.FindField("FIELDNAME")) != null)
                            {
                                if (inObject.get_Value(inObject.Fields.FindField("FIELDNAME")) != DBNull.Value)
                                {
                                    try
                                    {
                                        LastValueEntry lstVal = AAState.lastValueProperties.GetProperty(inObject.get_Value(inObject.Fields.FindField("FIELDNAME")).ToString()) as LastValueEntry;
                                        if (lstVal != null)
                                        {
                                            lstVal.On_Manual = Globals.toBoolean(inObject.get_Value(inObject.Fields.FindField("ON_MANUAL")).ToString());
                                            lstVal.On_Create = Globals.toBoolean(inObject.get_Value(inObject.Fields.FindField("ON_CREATE")).ToString());
                                            lstVal.On_ChangeAtt = Globals.toBoolean(inObject.get_Value(inObject.Fields.FindField("ON_CHANGE")).ToString());

                                            if (inObject.Fields.FindField("ON_CHANGEGEO") >= 0)
                                            {
                                                lstVal.On_ChangeGeo = Globals.toBoolean(inObject.get_Value(inObject.Fields.FindField("ON_CHANGEGEO")).ToString());
                                            }
                                        }
                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14f"));
                                    }
                                    catch
                                    {
                                        //property does not exist

                                    }
                                }
                            }

                        }
                        else
                        {
                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14g"));
                        }
                        return false;
                    }

                    string modeVal;

                    if (AAState._dv.Table.Columns[mode] == null)
                    {
                        AAState.WriteLine(mode + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14h"));
                        mode = mode.Replace("GEO", "");

                    }
                    if (AAState._dv.Table.Columns[mode].DataType == System.Type.GetType("System.String"))
                    {
                        modeVal = "(" + mode + " = '1' or " + mode + " = 'Yes' or " + mode + " = 'YES' or " + mode + " = 'True' or " + mode + " = 'TRUE')";

                    }
                    else
                    {
                        modeVal = mode + " = 1";
                    }

                    //System.Int32 int32_hWnd = ArcMap.Application.hWnd;

                    //progressDialogFactory = new ESRI.ArcGIS.Framework.ProgressDialogFactoryClass();
                    //stepProgressor = progressDialogFactory.Create(trackCancel, int32_hWnd);

                    //stepProgressor.MinRange = 0;
                    //stepProgressor.MaxRange = inObject.Fields.FieldCount;
                    //stepProgressor.StepValue = 1;
                    //stepProgressor.Message = "Attribute Assistant Progress";
                    //// Create the ProgressDialog. This automatically displays the dialog
                    //progressDialog = (ESRI.ArcGIS.Framework.IProgressDialog2)stepProgressor; // Explict Cast

                    //// Set the properties of the ProgressDialog
                    //progressDialog.CancelEnabled = true;
                    ArcMap.Application.StatusBar.set_Message(0, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14i") + inObject.Class.AliasName);
                    //progressDialog.Description = A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14i") + inObject.Class.AliasName;
                    //progressDialog.Title = "Attribute Assistant Progress";
                    //progressDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressGlobe;
                    //progressDialog.ShowDialog();

                    //Optional skip junctions feature class
                    //if (Globals.isOrpanJunction(inFeature))
                    //    return false;

                    //Get table name for this feature
                    _currentDataset = inObject.Class as IDataset;
                    _currentDatasetNameItems = _currentDataset.Name.Split('.');
                    tableName = _currentDatasetNameItems[_currentDatasetNameItems.GetLength(0) - 1];

                    ArcMap.Application.StatusBar.set_Message(0, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain10") + inObject.Class.AliasName);
                    //stepProgressor.Message = A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain10") + inObject.Class.AliasName;
                    // progressDialog.Description = A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain10") + inObject.Class.AliasName;
                    AAState.WriteLine("***********************************************************");
                    AAState.WriteLine("############ " + DateTime.Now + " ################");

                    AAState.WriteLine("");
                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain11"));

                    if (AAState._dv.Table.Columns.Contains("RUN_WEIGHT"))
                        AAState._dv.Sort = "RUN_WEIGHT DESC";

                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14j") + inObject.Class.AliasName);
                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14k") + "(TABLENAME = '*' OR TABLENAME = '" + tableName + "' OR TABLENAME like '" + tableName + "|*' OR TABLENAME like '" + tableName + "|%') AND VALUEMETHOD = 'Last_Value'");
                    AAState._dv.RowFilter = "(TABLENAME = '*' OR TABLENAME = '" + tableName + "' OR TABLENAME like '" + tableName + "|*' OR TABLENAME like '" + tableName + "|%') AND VALUEMETHOD = 'Last_Value'";
                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14l")  + AAState._dv.Count.ToString());

                    if (AAState._dv.Count > 0)
                    {
                        IRowChanges pRowChLast = inObject as IRowChanges;
                        for (int retRows = 0; retRows < AAState._dv.Count; retRows++)
                        {
                            DataRowView drv = AAState._dv[retRows];
                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14m")  + drv["FIELDNAME"].ToString());

                            int fldLoc = inObject.Fields.FindField(drv["FIELDNAME"].ToString());

                            if (fldLoc > 0)
                            {
                                AAState.WriteLine("       " + drv["FIELDNAME"].ToString() + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14n")  + fldLoc);

                                if (pRowChLast.get_ValueChanged(fldLoc))
                                {
                                    AAState.WriteLine("       " + drv["FIELDNAME"].ToString() + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14o") );

                                    try
                                    {
                                        LastValueEntry lstVal = (AAState.lastValueProperties.GetProperty(drv["FIELDNAME"].ToString()) as LastValueEntry);

                                        if (lstVal != null)
                                        {

                                            if (inObject.get_Value(fldLoc) != null)
                                            {
                                                if (inObject.get_Value(fldLoc) != DBNull.Value)
                                                {

                                                    if (lstVal.Value != null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14p") );
                                                        AAState.WriteLine("                           " + drv["FIELDNAME"].ToString() + ": " + inObject.get_Value(fldLoc).ToString());
                                                        lstVal.Value = inObject.get_Value(fldLoc);

                                                        AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), lstVal);
                                                    }

                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14p") );
                                                        AAState.WriteLine("                           " + drv["FIELDNAME"].ToString() + ": " + inObject.get_Value(fldLoc));
                                                        lstVal.Value = inObject.get_Value(fldLoc);

                                                        AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), lstVal);
                                                    }

                                                }
                                                else
                                                {
                                                    if (mode == "ON_CREATE")
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14q") );

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14p") );
                                                        AAState.WriteLine("                           " + drv["FIELDNAME"].ToString() + ": NULL");
                                                        lstVal.Value = null;
                                                        AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), lstVal);
                                                    }

                                                }
                                            }
                                            else
                                            {
                                                if (mode == "ON_CREATE")
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14q") );

                                                }
                                                else
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14p") );
                                                    AAState.WriteLine("                           " + drv["FIELDNAME"].ToString() + ": NULL");
                                                    lstVal.Value = null;
                                                    AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), lstVal);

                                                }
                                            }

                                        }
                                        else
                                        {
                                            lstVal = new LastValueEntry();
                                            lstVal.Value = inObject.get_Value(fldLoc);

                                            lstVal.On_Manual = Globals.toBoolean(drv["ON_MANUAL"].ToString());
                                            lstVal.On_Create = Globals.toBoolean(drv["ON_CREATE"].ToString());
                                            lstVal.On_ChangeAtt = Globals.toBoolean(drv["ON_CHANGE"].ToString());
                                            if (drv["ON_CHANGEGEO"] != null)
                                            {
                                                lstVal.On_ChangeGeo = Globals.toBoolean(drv["ON_CHANGEGEO"].ToString());
                                            }
                                            AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), lstVal);

                                        }

                                    }
                                    catch
                                    {

                                    }

                                }
                                else
                                {
                                    AAState.WriteLine("       " + drv["FIELDNAME"].ToString() + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14r") );

                                }
                            }
                        }

                        pRowChLast = null;

                    }

                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14s")  + inObject.Class.AliasName);
                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14k") + "(TABLENAME = '*' OR TABLENAME = '" + tableName + "' OR TABLENAME like '" + tableName + "|*' OR TABLENAME like '" + tableName + "|%') AND " + modeVal);
                    AAState._dv.RowFilter = "(TABLENAME = '*' OR TABLENAME = '" + tableName + "' OR TABLENAME like '" + tableName + "|*' OR TABLENAME like '" + tableName + "|%') AND " + modeVal;
                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14l")  + AAState._dv.Count.ToString());
                    if (AAState._processCount > 2)
                    {
                        System.Threading.Thread.Sleep(400);
                    }
                    if (AAState._processCount > 15)
                    {
                        MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14t") );

                        return false;

                    }
                    if (AAState._dv.Count > 0)
                    {
                        bool proc = false;
                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14u") );

                        for (int retRows = 0; retRows < AAState._dv.Count; retRows++)
                        {
                            DataRowView drv = AAState._dv[retRows];

                            AAState.WriteLine("    ------------------------------------------------");
                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14v") );
                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14w")  + (retRows + 1).ToString());
                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14x")  + drv["TABLENAME"].ToString());
                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14y")  + drv["FIELDNAME"].ToString());
                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14z")  + drv["VALUEINFO"].ToString());
                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14aa")  + drv["VALUEMETHOD"].ToString());
                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ab")  + drv["ON_CREATE"].ToString());
                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ac")  + drv["ON_CHANGE"].ToString());
                            if (AAState._dv.Table.Columns.Contains("RUNORDER"))
                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ad")  + drv["RUNORDER"].ToString());

                            AAState.WriteLine("");

                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ae") );
                            valFC = drv["TABLENAME"].ToString().Trim();
                            if (valFC.Contains("|"))
                            {
                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14af") );
                                string[] spliVal = valFC.Split('|');
                                List<string> validSubtypes = new List<string>(spliVal[1].Split(','));
                                List<string> inValidSubtypes;
                                if (spliVal.GetLength(0) == 3)
                                {
                                    inValidSubtypes = new List<string>(spliVal[2].Split(','));
                                }
                                else
                                {
                                    inValidSubtypes = new List<string>();
                                }

                                int obSubVal;
                                ISubtypes pSub = inObject.Class as ISubtypes;
                                if (pSub != null)
                                {
                                    if (pSub.HasSubtype)
                                    {
                                        if (inObject.get_Value(pSub.SubtypeFieldIndex).ToString() != "")
                                        {
                                            obSubVal = Convert.ToInt32(inObject.get_Value(pSub.SubtypeFieldIndex).ToString());
                                            if (validSubtypes.Contains("*"))
                                            {
                                                if (inValidSubtypes.Contains(obSubVal.ToString()))
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ag") );
                                                    proc = false;
                                                    continue;
                                                }
                                                else
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ah") );
                                                }
                                            }

                                            else if (validSubtypes.Contains(obSubVal.ToString()))
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ah") );
                                            }
                                            else
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ag") );
                                                proc = false;
                                                continue;
                                            }
                                        }
                                        else
                                        {
                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ai") );
                                            proc = false;
                                            continue;
                                        }
                                    }
                                    else
                                    {
                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14aj") );
                                    }
                                }
                                else
                                {
                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14aj") );
                                }

                            }
                            valMethod = drv["VALUEMETHOD"].ToString().ToUpper().Trim();
                            valData = drv["VALUEINFO"].ToString().Trim();
                            if (valData.Contains(Environment.NewLine))
                            {
                                valData = valData.Substring(0, valData.IndexOf(Environment.NewLine));

                            }
                            List<string> strFldNames = new List<string>();
                            List<string> strFldAlias = new List<string>();
                            List<int> intFldIdxs = new List<int>();
                            fieldObj = null;
                            if (drv["FIELDNAME"] != null && drv["FIELDNAME"].ToString().Trim() != "" && drv["FIELDNAME"].ToString().Trim() != "*" && drv["FIELDNAME"].ToString().Trim() != "#")
                            {
                                strFldNames = new List<string>(drv["FIELDNAME"].ToString().Trim().Split(','));
                                foreach (string strFldName in strFldNames)
                                {
                                    if (inObject.Fields.FindField(strFldName) >= 0)
                                    {
                                        strFldAlias.Add(inObject.Fields.get_Field(inObject.Fields.FindField(strFldName)).AliasName);

                                        int tem = inObject.Fields.FindField(strFldName);
                                        intFldIdxs.Add(tem);
                                        fieldObj = inObject.Fields.get_Field(tem);
                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ak")  + inObject.Fields.get_Field(inObject.Fields.FindField(strFldName)).AliasName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14al")  + tem);

                                        proc = true;
                                    }
                                    else if (inObject.Fields.FindFieldByAliasName(strFldName) >= 0)
                                    {
                                        int tem = inObject.Fields.FindFieldByAliasName(strFldName);
                                        intFldIdxs.Add(tem);
                                        strFldAlias.Add(inObject.Fields.get_Field(tem).AliasName);

                                        fieldObj = inObject.Fields.get_Field(tem);

                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ak")  + strFldName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14al")  + tem);

                                        proc = true;
                                    }
                                    else
                                    {
                                        intFldIdxs.Add(-1);
                                        strFldAlias.Add("{Not Found}");

                                        AAState.WriteLine("      " + strFldName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14am") );

                                        fieldObj = null;
                                        proc = false;
                                    }
                                }
                            }
                            else if (drv["FIELDNAME"].ToString() == "#")
                            {
                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14an") );
                                IRowChanges pRowCh = null;
                                IField pTmpFld = null;
                                pRowCh = inObject as IRowChanges;

                                for (int i = 0; i < inObject.Fields.FieldCount; i++)
                                {
                                    pTmpFld = inObject.Fields.get_Field(i);

                                    if (pTmpFld.Type != esriFieldType.esriFieldTypeGlobalID &&
                                                               pTmpFld.Type != esriFieldType.esriFieldTypeOID &&
                                                               pTmpFld.Type != esriFieldType.esriFieldTypeGeometry &&
                                                                pTmpFld.Name.ToUpper() != "SHAPE_LENGTH" &&
                                                               pTmpFld.Name.ToUpper() != "SHAPE.LEN" &&
                                                               pTmpFld.Name.ToUpper() != "SHAPE_AREA" &&
                                                               pTmpFld.Name.ToUpper() != "SHAPE.AREA")
                                    {
                                        if (pRowCh.get_ValueChanged(i) == true)
                                        {
                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ao")  + pTmpFld.Name + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ap") );
                                            strFldNames.Add(pTmpFld.Name);
                                            intFldIdxs.Add(i);
                                            proc = true;

                                        }
                                    }

                                }
                                pRowCh = null;
                                pTmpFld = null;
                            }
                            else
                            {
                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14aq") );
                                fieldObj = null;
                                proc = true;
                            }

                            if (proc)
                            {

                                try
                                {
                                    switch (valMethod)
                                    {

                                        case "FIELD_TRIGGER"://Value|FieldToChange|Value

                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "FIELD_TRIGGER" );
                                                if (inFeature != null & valData != null)
                                                {

                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    string valToCheck = "";
                                                    string fldToChange = "";
                                                    string valToSet = "";
                                                    if (args.GetLength(0) == 3)
                                                    {
                                                        valToCheck = args[0];
                                                        fldToChange = args[1];
                                                        valToSet = args[2];

                                                    }

                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14av"));
                                                        continue;
                                                    }

                                                    IRowChanges pRowCh = null;

                                                    pRowCh = inObject as IRowChanges;

                                                    if (intFldIdxs.Count == 0)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14aw"));
                                                        continue;
                                                    }
                                                    if (intFldIdxs[0] == -1)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14am"));
                                                        continue;
                                                    }
                                                    if (pRowCh.get_ValueChanged(intFldIdxs[0]))
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ax"));
                                                        if (inObject.get_Value(intFldIdxs[0]).ToString() == valToCheck)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                            int chngFldIdx = Globals.GetFieldIndex(inObject.Fields, fldToChange);
                                                            if (chngFldIdx == -1)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14am"));
                                                                continue;
                                                            }
                                                            try
                                                            {
                                                                inObject.set_Value(chngFldIdx, valToSet);
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));
                                                            }
                                                            catch
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14c") + valToSet);
                                                            }

                                                        }
                                                    }
                                                    pRowCh = null;

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "FIELD_TRIGGER: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "FIELD_TRIGGER");
                                            }
                                            break;
                                        case "VALIDATE_ATTRIBUTE_LOOKUP":
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "VALIDATE_ATTRIBUTE_LOOKUP");
                                                IRowChanges pRowCh = null;
                                                ISQLSyntax sqlSyntax = null;
                                                IQueryFilter pQFilt = null;
                                                try
                                                {
                                                    if ((valData != null) && (inObject != null))
                                                    {

                                                        pRowCh = inObject as IRowChanges;
                                                        bool valueChanged = false;
                                                        for (int i = 0; i < intFldIdxs.Count; i++)
                                                        {
                                                            if (pRowCh.get_ValueChanged(intFldIdxs[i]) == true)
                                                            {
                                                                valueChanged = true;
                                                                break;

                                                            }
                                                        }
                                                        if (valueChanged == false)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain12"));
                                                            continue;
                                                        }
                                                        sourceLayerName = "";
                                                        string[] sourceFieldNames = null;

                                                        // Parse arguments
                                                        args = valData.Split('|');
                                                        if (args.Length == 2)
                                                        {
                                                            sourceLayerName = args[0].ToString().Trim();
                                                            sourceFieldNames = args[1].ToString().Split(',');

                                                        }

                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14d"));
                                                            continue;

                                                        }

                                                        if ((sourceFieldNames != null) &&
                                                            (sourceFieldNames.Length > 0))
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain13") + sourceLayerName);

                                                            boolLayerOrFC = true;
                                                            if (sourceLayerName.Contains("("))
                                                            {
                                                                string[] tempSplt = sourceLayerName.Split('(');
                                                                sourceLayerName = tempSplt[0];
                                                                sourceLayer = Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC) as IFeatureLayer;
                                                                if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                                {
                                                                    boolLayerOrFC = true;
                                                                }
                                                                else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                                {
                                                                    boolLayerOrFC = true;
                                                                }
                                                                else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                                {
                                                                    boolLayerOrFC = false;
                                                                }
                                                                else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                                {
                                                                    boolLayerOrFC = false;
                                                                }
                                                                else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                                {
                                                                    boolLayerOrFC = false;
                                                                }
                                                                else
                                                                {
                                                                    boolLayerOrFC = true;
                                                                }
                                                            }
                                                            else
                                                            {

                                                                sourceLayer = Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC) as IFeatureLayer;
                                                            }

                                                            IFields pFlds = null;

                                                            IDataset pDs = null;
                                                            string layNameFnd = "";
                                                            bool matchingLayFnd = false;
                                                            IStandaloneTable pTbl = null;
                                                            if (sourceLayer != null)
                                                            {
                                                                if (sourceLayer.FeatureClass != null)
                                                                {
                                                                    pFlds = sourceLayer.FeatureClass.Fields;
                                                                    pDs = sourceLayer.FeatureClass as IDataset;
                                                                    layNameFnd = sourceLayer.Name;
                                                                    matchingLayFnd = true;
                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + sourceLayerName + " data source is not set");
                                                                    continue;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                pTbl = Globals.FindStandAloneTable(AAState._editor.Map, sourceLayerName) as IStandaloneTable;

                                                                if (pTbl != null)
                                                                {
                                                                    if (pTbl.Table != null)
                                                                    {
                                                                        pFlds = pTbl.Table.Fields;
                                                                        pDs = pTbl.Table as IDataset;
                                                                        layNameFnd = pTbl.Name;

                                                                        matchingLayFnd = true;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + sourceLayerName + " data source is not set");
                                                                    continue;
                                                                }

                                                            }
                                                            if (matchingLayFnd == false)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + sourceLayerName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                continue;
                                                            }
                                                            sqlSyntax = (ISQLSyntax)(pDs.Workspace);
                                                            string specChar = sqlSyntax.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_WildcardManyMatch);

                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain14") + layNameFnd + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain15") + sourceLayerName);

                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain16"));

                                                            if (sourceFieldNames.Length != intFldIdxs.Count)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain17"));
                                                                continue;

                                                            }
                                                            int[] sourceFieldNums = new int[sourceFieldNames.Length];

                                                            pQFilt = new QueryFilterClass();
                                                            string sqlString = "";
                                                            string sqlStringUpper = "";
                                                            string sqlUpp = "";
                                                            if (sqlSyntax.GetStringComparisonCase())
                                                            {
                                                                sqlUpp = "UPPER";
                                                            }
                                                            for (int i = 0; i < sourceFieldNames.Length; i++)
                                                            {
                                                                sourceFieldNums[i] = Globals.GetFieldIndex(pFlds, sourceFieldNames[i].Trim());
                                                                if (sourceFieldNums[i] < 0)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain18") + sourceFieldName[i]);
                                                                    break;

                                                                }
                                                                if (pFlds.get_Field(sourceFieldNums[i]).Type == esriFieldType.esriFieldTypeString)
                                                                {
                                                                    if (sqlString == "")
                                                                    {
                                                                        sqlString = pFlds.get_Field(sourceFieldNums[i]).Name + "" + " = '" + inObject.get_Value(intFldIdxs[i]).ToString() + "'";
                                                                        sqlStringUpper = sqlUpp + "(" + pFlds.get_Field(sourceFieldNums[i]).Name + ")" + " LIKE '" + specChar + inObject.get_Value(intFldIdxs[i]).ToString().ToUpper().Replace(" ", specChar) + specChar + "'";
                                                                    }
                                                                    else
                                                                    {
                                                                        sqlString = sqlString + " AND " + pFlds.get_Field(sourceFieldNums[i]).Name + "" + " = '" + inObject.get_Value(intFldIdxs[i]).ToString() + "'";
                                                                        sqlStringUpper = sqlStringUpper + " AND " + sqlUpp + "(" + pFlds.get_Field(sourceFieldNums[i]).Name + ")" + " LIKE '" + specChar + inObject.get_Value(intFldIdxs[i]).ToString().ToUpper().Replace(" ", specChar) + specChar + "'";
                                                                    }

                                                                }
                                                                else
                                                                {
                                                                    if (sqlString == "")
                                                                    {
                                                                        sqlString = pFlds.get_Field(sourceFieldNums[i]).Name + " = " + inObject.get_Value(intFldIdxs[i]);
                                                                        sqlStringUpper = pFlds.get_Field(sourceFieldNums[i]).Name + " LIKE " + specChar + inObject.get_Value(intFldIdxs[i]) + specChar;
                                                                    }
                                                                    else
                                                                    {
                                                                        sqlString = sqlString + " AND " + pFlds.get_Field(sourceFieldNums[i]).Name + " = " + inObject.get_Value(intFldIdxs[i]);
                                                                        sqlStringUpper = sqlStringUpper + " AND " + pFlds.get_Field(sourceFieldNums[i]).Name + " LIKE " + specChar + inObject.get_Value(intFldIdxs[i]) + specChar;
                                                                    }
                                                                }

                                                            }
                                                            pQFilt.WhereClause = sqlString;

                                                            AAState.WriteLine("                  " + pQFilt.WhereClause + " used to search for matching record");
                                                            int intRecFound = 0;
                                                            if (sourceLayer == null)
                                                            {
                                                                intRecFound = pTbl.Table.RowCount(pQFilt);
                                                            }
                                                            else
                                                            {
                                                                intRecFound = sourceLayer.FeatureClass.FeatureCount(pQFilt);
                                                            }

                                                            AAState.WriteLine("                  " + intRecFound + " rows found using " + sqlString);

                                                            if (intRecFound != 1)
                                                            {

                                                                pQFilt.WhereClause = sqlStringUpper;

                                                                AAState.WriteLine("                  " + pQFilt.WhereClause + " used to search for matching record");
                                                                if (sourceLayer == null)
                                                                {
                                                                    intRecFound = pTbl.Table.RowCount(pQFilt);
                                                                }
                                                                else
                                                                {
                                                                    intRecFound = sourceLayer.FeatureClass.FeatureCount(pQFilt);
                                                                }
                                                                AAState.WriteLine("                  " + intRecFound + " rows found");

                                                                if (intRecFound == 0)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain19"));
                                                                    AAState._editor.AbortOperation();
                                                                    return false;

                                                                }

                                                                else
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain20"));
                                                                    ICursor pCurs = null;
                                                                    if (sourceLayer == null)
                                                                    {
                                                                        pCurs = pTbl.Table.Search(pQFilt, true);
                                                                    }
                                                                    else
                                                                    {
                                                                        pCurs = sourceLayer.FeatureClass.Search(pQFilt, true) as ICursor;
                                                                    }

                                                                    pQFilt = null;

                                                                    List<string> pLst = Globals.CursorToList(ref pCurs, sourceFieldNums);
                                                                    if (pCurs != null)
                                                                        Marshal.ReleaseComObject(pCurs);
                                                                    pCurs = null;

                                                                    string disFld = "";
                                                                    for (int j = 0; j < sourceFieldNames.Length - 1; j++)
                                                                    {
                                                                        disFld = disFld == "" ? sourceFieldNames[j] : disFld + "|" + sourceFieldNames[j];

                                                                    }
                                                                    string selectVal = Globals.showOptionsForm(pLst, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain21") + disFld, ComboBoxStyle.DropDownList);
                                                                    if (selectVal == "||Cancelled||")
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain19"));
                                                                        AAState._editor.AbortOperation();
                                                                        return false;

                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain22") + selectVal);
                                                                        string[] strVals = selectVal.Split('|');

                                                                        for (int i = 0; i < sourceFieldNums.Length; i++)
                                                                        {
                                                                            inObject.set_Value(intFldIdxs[i], (strVals[i].Trim()));
                                                                        }

                                                                    }

                                                                }
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain23"));
                                                            }
                                                            pQFilt = null;

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14e") + valData);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14f"));
                                                    }
                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "VALIDATE_ATTRIBUTE_LOOKUP" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    pQFilt = null;
                                                    sqlSyntax = null;
                                                    pRowCh = null;
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "VALIDATE_ATTRIBUTE_LOOKUP");
                                                }
                                                break;
                                            }

                                        case "PREVIOUS_VALUE":
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "PREVIOUS_VALUE");
                                                IRowChanges pRowCh = null;
                                                try
                                                {
                                                    if ((valData != null) && (inObject != null))
                                                    {

                                                        pRowCh = inObject as IRowChanges;
                                                        bool valueChanged = false;
                                                        for (int i = 0; i < intFldIdxs.Count; i++)
                                                        {
                                                            if (pRowCh.get_ValueChanged(intFldIdxs[i]) == true)
                                                            {
                                                                valueChanged = true;
                                                                break;

                                                            }
                                                        }
                                                        if (valueChanged == false)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain24"));
                                                            continue;
                                                        }

                                                        string[] sourceFieldNames = null;

                                                        // Parse arguments
                                                        args = valData.Split('|');
                                                        if (args.Length == 1)
                                                        {

                                                            sourceFieldNames = args[0].ToString().Split(',');

                                                        }

                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14d"));
                                                            continue;

                                                        }

                                                        if ((sourceFieldNames != null) &&
                                                            (sourceFieldNames.Length > 0))
                                                        {
                                                            int flx = inObject.Fields.FindField(sourceFieldNames[0]);
                                                            if (flx > 0)
                                                            {
                                                                inObject.set_Value(flx, pRowCh.get_OriginalValue(intFldIdxs[0]));
                                                                inObject.Store();

                                                            }
                                                        }
                                                        else
                                                        {

                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14e") + valData);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14f"));
                                                    }
                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "PREVIOUS_VALUE" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {

                                                    pRowCh = null;
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "PREVIOUS_VALUE");
                                                }
                                                break;
                                            }

                                        case "ANGLE":

                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "ANGLE");
                                                if (inFeature != null)
                                                {
                                                    if (intFldIdxs.Count == 0)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain25"));
                                                        continue;

                                                    }
                                                    if ((inFeature.Class as IFeatureClass).ShapeType != esriGeometryType.esriGeometryPolyline)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain26"));
                                                        continue;
                                                    }

                                                    bool boolGeo = true;
                                                    if (valData.Trim() != "")
                                                    {
                                                        if (valData.ToUpper() == "A")
                                                        {
                                                            boolGeo = false;
                                                        }
                                                    }
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain27"));
                                                    IPolyline pLyLine = inFeature.Shape as IPolyline;

                                                    ILine pLine = new LineClass();
                                                    pLine.ToPoint = pLyLine.FromPoint;
                                                    pLine.FromPoint = pLyLine.ToPoint;

                                                    double angArth = pLine.Angle * 180 / Math.PI;
                                                    if (angArth < 0)
                                                    {
                                                        angArth = 360 + angArth;
                                                    }

                                                    double angGeo = 270 - angArth;
                                                    if (angGeo < 0)
                                                    {
                                                        angGeo = 360 + angGeo;
                                                    }
                                                    double ang;
                                                    if (boolGeo)
                                                    {
                                                        ang = angGeo;
                                                    }
                                                    else
                                                    {
                                                        ang = angArth;
                                                    }
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain28") + ang);
                                                    try
                                                    {
                                                        inObject.set_Value(intFldIdxs[0], ang);
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain29"));

                                                    }
                                                    catch
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain30"));
                                                    }

                                                    pLine = null;
                                                    pLyLine = null;

                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain31"));

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "ANGLE: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "ANGLE");
                                            }
                                            break;

                                        case "CREATE_PERP_LINE"://Layer to Search For|Offset Distante or Field|Search distance to look for a line|UseSnapPoint|TargetLayer|TargetLayerTemplate

                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "CREATE_PERP_LINE");
                                                if (inFeature != null & valData != null)
                                                {
                                                    sourceLayerName = "";
                                                    double offsetVal = 5;
                                                    bool useSnapPnt = false;
                                                    string targetLayerName = "";
                                                    IFeatureLayer targetLayer = null;
                                                    string targetLayerTemp = "";

                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    int fldOff = -1;
                                                    if (args.GetLength(0) == 6)
                                                    {

                                                        sourceLayerNames = args[0].ToString().Split(',');

                                                        if (Globals.IsNumeric(args[1]))
                                                            Double.TryParse(args[1], out offsetVal);
                                                        else
                                                        {
                                                            fldOff = Globals.GetFieldIndex(inObject.Fields, args[1]);

                                                        }

                                                        Double.TryParse(args[2], out searchDistance);
                                                        Boolean.TryParse(args[3], out useSnapPnt);
                                                        targetLayerName = args[4];
                                                        targetLayerTemp = args[5];

                                                    }
                                                    else if (args.GetLength(0) == 5)
                                                    {

                                                        sourceLayerNames = args[0].ToString().Split(',');

                                                        if (Globals.IsNumeric(args[1]))
                                                            Double.TryParse(args[1], out offsetVal);
                                                        else
                                                        {
                                                            fldOff = Globals.GetFieldIndex(inObject.Fields, args[1]);

                                                        }

                                                        Double.TryParse(args[2], out searchDistance);
                                                        Boolean.TryParse(args[3], out useSnapPnt);
                                                        targetLayerName = args[4];
                                                        targetLayerTemp = "";
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14av"));
                                                        continue;
                                                    }
                                                    if (intFldIdxs.Count > 0)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain32"));
                                                        continue;
                                                    }

                                                    targetLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, targetLayerName, ref boolLayerOrFC);
                                                    if (targetLayer == null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14g") + targetLayerName);
                                                        continue;
                                                    }
                                                    if (targetLayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolyline)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14h") + targetLayerName);
                                                        continue;
                                                    }
                                                    if (targetLayer is ICadastralFabricSubLayer2)
                                                    {
                                                      AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14i") + targetLayerName);
                                                      continue;
                                                    }

                                                    for (int i = 0; i < sourceLayerNames.Length; i++)
                                                    {
                                                        sourceLayerName = sourceLayerNames[i].ToString();
                                                        if (sourceLayerName != "")

                                                            sourceLayerName = args[i].ToString();
                                                        if (i == 0)
                                                            i++;
                                                        boolLayerOrFC = true;

                                                        if (sourceLayerName.Contains("("))
                                                        {
                                                            string[] tempSplt = sourceLayerName.Split('(');
                                                            sourceLayerName = tempSplt[0];
                                                            sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);

                                                            if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                            {
                                                                boolLayerOrFC = true;
                                                            }
                                                            else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                            {
                                                                boolLayerOrFC = true;
                                                            }
                                                            else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                            {
                                                                boolLayerOrFC = false;
                                                            }
                                                            else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                            {
                                                                boolLayerOrFC = false;
                                                            }
                                                            else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                            {
                                                                boolLayerOrFC = false;
                                                            }
                                                            else
                                                            {
                                                                boolLayerOrFC = true;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);

                                                        }
                                                        if (sourceLayer == null)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14b") + sourceLayer + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                            continue;
                                                        }
                                                        if (fldOff != -1)
                                                        {
                                                            try
                                                            {
                                                                string temp = inObject.get_Value(fldOff).ToString();
                                                                if (Globals.IsNumeric(temp))
                                                                {
                                                                    Double.TryParse(temp, out offsetVal);
                                                                }
                                                            }
                                                            catch
                                                            {
                                                            }

                                                        }

                                                        IPolyline pTempLine = new PolylineClass();
                                                        pTempLine = Globals.CreateAngledLineFromLocationOnLine((IPoint)inFeature.Shape, sourceLayer,
                                                            boolLayerOrFC, Globals.ConvertDegToRads(90), offsetVal, "true", true, false);

                                                        IEditTemplate pTemp = null;
                                                        IFeature pFeat = null;

                                                        if (targetLayerTemp != "")
                                                            pTemp = Globals.GetEditTemplate(targetLayerTemp, targetLayer);
                                                        if (pTemp != null)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain33"));
                                                            pFeat = Globals.CreateFeature(pTempLine, pTemp, AAState._editor, ArcMap.Application, false, false, false);

                                                        }
                                                        else
                                                        {

                                                            pFeat = Globals.CreateFeature(pTempLine, targetLayer, AAState._editor, ArcMap.Application, false, false, false);
                                                        }

                                                        if (NewFeatureList == null)
                                                        {
                                                            NewFeatureList = new List<IObject>();
                                                        }
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain34"));
                                                        NewFeatureList.Add(pFeat);

                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "CREATE_PERP_LINE: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "CREATE_PERP_LINE");
                                            }
                                            break;
                                        case "AUTONUMBER"://Layer to Search For|Offset Distante or Field|Search distance to look for a line

                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "AUTONUMBER");
                                                if (inObject != null)
                                                {
                                                    if (intFldIdxs.Count == 0)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain25"));
                                                        continue;

                                                    }
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain35") + strFldNames[0]);
                                                    string res = Globals.GetFieldStats(inObject.Class as IFeatureClass, strFldNames[0], Globals.statsType.Max);
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain36") + res);
                                                    if (res == "External component has thrown an exception.")
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain37"));

                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cm"));
                                                        long val = 1;

                                                        try
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14co"));
                                                            inObject.set_Value(intFldIdxs[0], val);
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));

                                                        }
                                                        catch (Exception ex)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14j") + ex.Message.ToString());
                                                        }
                                                    }
                                                    else
                                                    {

                                                        if (Globals.IsNumeric(res))
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cs"));

                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cr") + res);
                                                            try
                                                            {
                                                                long val = (Convert.ToInt64(res) + 1);

                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cq") + res);
                                                                try
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14co") + res);
                                                                    inObject.set_Value(intFldIdxs[0], val);
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az") + res);

                                                                }
                                                                catch (Exception ex)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14j") + ex.Message.ToString());
                                                                }

                                                            }

                                                            catch (Exception ex)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14j") + ex.Message.ToString());
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cp"));
                                                                long val = 1;

                                                                inObject.set_Value(intFldIdxs[0], val);
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));

                                                            }

                                                        }

                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cn") + res);

                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cm"));
                                                            long val = 1;

                                                            try
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14co") + res);
                                                                inObject.set_Value(intFldIdxs[0], val);
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az") + res);

                                                            }
                                                            catch (Exception ex)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14j") + ex.Message.ToString());
                                                            }

                                                        }
                                                    }

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "AUTONUMBER: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "AUTONUMBER");
                                            }
                                            break;

                                        case "COPY_LINKED_RECORD"://Feature Layer|Field To Copy|Primary Key Field|Foreign Key Field
                                            {
                                                try
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "COPY_LINKED_RECORD");
                                                    if (!String.IsNullOrEmpty(valData))
                                                    {
                                                        args = valData.Split('|');
                                                        if (args.Length != 4)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ad"));
                                                            break;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ad"));
                                                        break;
                                                    }
                                                    if (inObject == null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ak"));
                                                        break;
                                                    }
                                                    string[] targetLayerNames;
                                                    string targetFieldName = "";

                                                    found = false;
                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bs"));
                                                    targetLayerNames = args[0].ToString().Split(',');
                                                    targetFieldName = args[1].ToString();
                                                    string targetLayerName = "";
                                                    string sourceIDFieldName = args[2].ToString();
                                                    string targetIDFieldName = args[3].ToString();
                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bt"));
                                                    if (targetFieldName != null)
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cj"));

                                                        int fldIDSourecIdx = Globals.GetFieldIndex(inObject.Fields, sourceIDFieldName);
                                                        if (fldIDSourecIdx > -1 && intFldIdxs.Count > 0)
                                                        {
                                                            if (inObject.get_Value(fldIDSourecIdx) != null && inObject.get_Value(fldIDSourecIdx) != DBNull.Value)
                                                            {
                                                                if (inObject.get_Value(fldIDSourecIdx).ToString() != "")
                                                                {

                                                                    for (int i = 0; i < targetLayerNames.Length; i++)
                                                                    {
                                                                        targetLayerName = targetLayerNames[i].ToString().Trim();

                                                                        if (targetLayerName != "")
                                                                        {

                                                                            // Get layer
                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cl"));
                                                                            bool FCorLayerSource = true;
                                                                            sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, targetLayerName, ref FCorLayerSource);

                                                                            if (sourceLayer != null)
                                                                            {

                                                                                int fldValToCopyIdx = sourceLayer.FeatureClass.Fields.FindField(targetFieldName);
                                                                                int fldIDTargetIdx = sourceLayer.FeatureClass.Fields.FindField(targetIDFieldName);
                                                                                if (fldIDTargetIdx > -1 && fldValToCopyIdx > -1)
                                                                                {
                                                                                    IQueryFilter pQFilt = Globals.createQueryFilter();
                                                                                    if (sourceLayer.FeatureClass.Fields.get_Field(fldIDTargetIdx).Type == esriFieldType.esriFieldTypeString)
                                                                                    {
                                                                                        pQFilt.WhereClause = "" + sourceLayer.FeatureClass.Fields.get_Field(fldIDTargetIdx).Name + "" + " = '" + inObject.get_Value(fldIDSourecIdx).ToString() + "'";

                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        pQFilt.WhereClause = sourceLayer.FeatureClass.Fields.get_Field(fldIDTargetIdx).Name + " = " + inObject.get_Value(fldIDSourecIdx);

                                                                                    }
                                                                                    IFeatureCursor pCurs;

                                                                                    pCurs = sourceLayer.FeatureClass.Search(pQFilt, true);
                                                                                    IFeature pRow;
                                                                                    while ((pRow = pCurs.NextFeature()) != null)
                                                                                    {
                                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cf"));
                                                                                        try
                                                                                        {
                                                                                            inObject.set_Value(intFldIdxs[0], pRow.get_Value(fldValToCopyIdx));
                                                                                            break;

                                                                                        }
                                                                                        catch
                                                                                        {
                                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aw") + inObject.get_Value(fldValToCopyIdx) + " to field: " + strFldNames[0]);
                                                                                        }

                                                                                        pRow = null;
                                                                                    }
                                                                                    pRow = null;

                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cd"));

                                                                                    if (pCurs != null)
                                                                                        Marshal.ReleaseComObject(pCurs);
                                                                                    pCurs = null;

                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14k"));
                                                                                }

                                                                            }
                                                                            else
                                                                            {

                                                                                ITable pTable = Globals.FindTable(AAState._editor.Map, targetLayerName);
                                                                                if (pTable != null)
                                                                                {
                                                                                    int fldValToCopyIdx = Globals.GetFieldIndex(pTable.Fields, targetFieldName);
                                                                                    int fldIDTargetIdx = Globals.GetFieldIndex(pTable.Fields, targetIDFieldName);
                                                                                    if (fldIDTargetIdx > -1 && fldValToCopyIdx > -1)
                                                                                    {
                                                                                        IQueryFilter pQFilt = Globals.createQueryFilter();
                                                                                        if (pTable.Fields.get_Field(fldIDTargetIdx).Type == esriFieldType.esriFieldTypeString)
                                                                                        {
                                                                                            pQFilt.WhereClause = "" + pTable.Fields.get_Field(fldIDTargetIdx).Name + "" + " = '" + inObject.get_Value(fldIDSourecIdx).ToString() + "'";

                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            pQFilt.WhereClause = pTable.Fields.get_Field(fldIDTargetIdx).Name + " = " + inObject.get_Value(fldIDSourecIdx);

                                                                                        }
                                                                                        ICursor pCurs;

                                                                                        pCurs = pTable.Search(pQFilt, true);
                                                                                        IRow pRow;
                                                                                        bool valSet = false;
                                                                                        pRow = pCurs.NextRow();
                                                                                        while (pRow != null)
                                                                                        {
                                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cf"));
                                                                                            try
                                                                                            {
                                                                                                inObject.set_Value(intFldIdxs[0], pRow.get_Value(fldValToCopyIdx));

                                                                                                AAState.WriteLine("                  " + pRow.get_Value(fldValToCopyIdx).ToString() + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ch"));
                                                                                                valSet = true;
                                                                                                break;

                                                                                            }
                                                                                            catch
                                                                                            {
                                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aw") + inObject.get_Value(fldValToCopyIdx) + " to field: " + strFldNames[0]);
                                                                                            }

                                                                                            pRow = pCurs.NextRow();

                                                                                        }
                                                                                        pRow = null;
                                                                                        if (valSet)
                                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cd"));
                                                                                        else
                                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ce"));

                                                                                        if (pCurs != null)
                                                                                            Marshal.ReleaseComObject(pCurs);
                                                                                        pCurs = null;

                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14k"));
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ax") + sourceLayerName);
                                                                                }
                                                                                pTable = null;

                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ck"));
                                                        }

                                                    }

                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "COPY_LINKED_RECORD" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "COPY_LINKED_RECORD");

                                                }
                                                break;

                                            }
                                        case "UPDATE_LINKED_RECORD"://Feature Layer|Field To Copy|Primary Key Field|Foreign Key Field
                                            {
                                                try
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "UPDATE_LINKED_RECORD");
                                                    if (!String.IsNullOrEmpty(valData))
                                                    {
                                                        args = valData.Split('|');
                                                        if (args.Length != 4)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ad"));
                                                            break;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ad"));
                                                        break;
                                                    }
                                                    if (inObject == null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ak"));
                                                        break;
                                                    }

                                                    IRowChanges pRowCh = inObject as IRowChanges;

                                                    if (pRowCh.get_ValueChanged(intFldIdxs[0]) == false && mode != "ON_CREATE")
                                                    {
                                                        AAState.WriteLine("                  PROMPT: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ck"));
                                                        pRowCh = null;
                                                        continue;
                                                    }
                                                    else
                                                    {
                                                        pRowCh = null;
                                                        string[] targetLayerNames;
                                                        string targetFieldName = "";

                                                        found = false;
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bs"));
                                                        targetLayerNames = args[0].ToString().Split(',');
                                                        targetFieldName = args[1].ToString();
                                                        string targetLayerName = "";
                                                        string sourceIDFieldName = args[2].ToString();
                                                        string targetIDFieldName = args[3].ToString();
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bt"));
                                                        if (targetFieldName != null)
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cj"));

                                                            int fldIDSourecIdx = Globals.GetFieldIndex(inObject.Fields, sourceIDFieldName);
                                                            if (fldIDSourecIdx > -1 && intFldIdxs.Count > 0)
                                                            {
                                                                if (inObject.get_Value(fldIDSourecIdx) != null && inObject.get_Value(fldIDSourecIdx) != DBNull.Value)
                                                                {
                                                                    if (inObject.get_Value(fldIDSourecIdx).ToString() != "")
                                                                    {

                                                                        for (int i = 0; i < targetLayerNames.Length; i++)
                                                                        {
                                                                            targetLayerName = targetLayerNames[i].ToString().Trim();

                                                                            if (targetLayerName != "")
                                                                            {

                                                                                // Get layer
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ci"));
                                                                                bool FCorLayerSource = true;
                                                                                sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, targetLayerName, ref FCorLayerSource);

                                                                                if (sourceLayer != null)
                                                                                {

                                                                                    int fldValToCopyIdx = sourceLayer.FeatureClass.Fields.FindField(targetFieldName);
                                                                                    int fldIDTargetIdx = sourceLayer.FeatureClass.Fields.FindField(targetIDFieldName);
                                                                                    if (fldIDTargetIdx > -1 && fldValToCopyIdx > -1)
                                                                                    {
                                                                                        IQueryFilter pQFilt = Globals.createQueryFilter();
                                                                                        if (sourceLayer.FeatureClass.Fields.get_Field(fldIDTargetIdx).Type == esriFieldType.esriFieldTypeString)
                                                                                        {
                                                                                            pQFilt.WhereClause = "" + sourceLayer.FeatureClass.Fields.get_Field(fldIDTargetIdx).Name + "" + " = '" + inObject.get_Value(fldIDSourecIdx).ToString() + "'";

                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            pQFilt.WhereClause = sourceLayer.FeatureClass.Fields.get_Field(fldIDTargetIdx).Name + " = " + inObject.get_Value(fldIDSourecIdx);

                                                                                        }
                                                                                        IFeatureCursor pCurs;

                                                                                        pCurs = sourceLayer.FeatureClass.Search(pQFilt, true);
                                                                                        IFeature pRow;
                                                                                        bool valSet = false;
                                                                                        while ((pRow = pCurs.NextFeature()) != null)
                                                                                        {
                                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cg"));
                                                                                            try
                                                                                            {
                                                                                                pRow.set_Value(fldValToCopyIdx, inObject.get_Value(intFldIdxs[0]));
                                                                                                pRow.Store();
                                                                                                AAState.WriteLine("                  " + inObject.get_Value(intFldIdxs[0]).ToString() + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ch"));
                                                                                                valSet = true;

                                                                                            }
                                                                                            catch
                                                                                            {
                                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aw") + inObject.get_Value(intFldIdxs[0]).ToString() + " to field: " + targetFieldName);
                                                                                            }

                                                                                            pRow = null;
                                                                                        }
                                                                                        pRow = null;

                                                                                        if (valSet)
                                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cd"));
                                                                                        else
                                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ce"));

                                                                                        if (pCurs != null)
                                                                                            Marshal.ReleaseComObject(pCurs);
                                                                                        pCurs = null;

                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14k"));
                                                                                    }

                                                                                }
                                                                                else
                                                                                {

                                                                                    ITable pTable = Globals.FindTable(AAState._editor.Map, targetLayerName);
                                                                                    if (pTable != null)
                                                                                    {
                                                                                        int fldValToCopyIdx = Globals.GetFieldIndex(pTable.Fields, targetFieldName);
                                                                                        int fldIDTargetIdx = Globals.GetFieldIndex(pTable.Fields, targetIDFieldName);
                                                                                        if (fldIDTargetIdx > -1 && fldValToCopyIdx > -1)
                                                                                        {
                                                                                            IQueryFilter pQFilt = Globals.createQueryFilter();
                                                                                            if (pTable.Fields.get_Field(fldIDTargetIdx).Type == esriFieldType.esriFieldTypeString)
                                                                                            {
                                                                                                pQFilt.WhereClause = "" + pTable.Fields.get_Field(fldIDTargetIdx).Name + "" + " = '" + inObject.get_Value(fldIDSourecIdx).ToString() + "'";

                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                pQFilt.WhereClause = pTable.Fields.get_Field(fldIDTargetIdx).Name + " = " + inObject.get_Value(fldIDSourecIdx);

                                                                                            }
                                                                                            ICursor pCurs;

                                                                                            pCurs = pTable.Search(pQFilt, false);
                                                                                            IRow pRow;
                                                                                            bool valSet = false;
                                                                                            pRow = pCurs.NextRow();
                                                                                            while (pRow != null)
                                                                                            {
                                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cf"));
                                                                                                try
                                                                                                {
                                                                                                    pRow.set_Value(fldValToCopyIdx, inObject.get_Value(intFldIdxs[0]));
                                                                                                    pRow.Store();

                                                                                                    AAState.WriteLine("                  " + inObject.get_Value(intFldIdxs[0]).ToString() + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ch"));
                                                                                                    valSet = true;

                                                                                                }
                                                                                                catch
                                                                                                {
                                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aw") + inObject.get_Value(fldValToCopyIdx) + " to field: " + strFldNames[0]);
                                                                                                }

                                                                                                pRow = pCurs.NextRow();

                                                                                            }
                                                                                            pRow = null;
                                                                                            if (valSet)
                                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cd"));
                                                                                            else
                                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ce"));

                                                                                            if (pCurs != null)
                                                                                                Marshal.ReleaseComObject(pCurs);
                                                                                            pCurs = null;

                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14k"));
                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ax") + sourceLayerName);
                                                                                    }
                                                                                    pTable = null;

                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ay"));
                                                            }

                                                        }

                                                    }

                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "UPDATE_LINKED_RECORD" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "UPDATE_LINKED_RECORD");

                                                }
                                                break;

                                            }

                                        case "OFFSET"://Layer to Search For|Offset Distante or Field|Search distance to look for a line

                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "OFFSET");
                                                if (inFeature != null & valData != null)
                                                {
                                                    sourceLayerName = "";
                                                    double offsetVal = 5;

                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    int fldOff = -1;
                                                    if (args.GetLength(0) >= 3)
                                                    {

                                                        sourceLayerNames = args[0].ToString().Split(',');

                                                        if (Globals.IsNumeric(args[1]))
                                                            Double.TryParse(args[1], out offsetVal);
                                                        else
                                                        {
                                                            fldOff = Globals.GetFieldIndex(inObject.Fields, args[1]);

                                                        }

                                                        Double.TryParse(args[2], out searchDistance);
                                                    }
                                                    else if (args.GetLength(0) >= 2)
                                                    {

                                                        sourceLayerNames = args[0].ToString().Split(',');

                                                        if (Globals.IsNumeric(args[1]))
                                                            Double.TryParse(args[1], out offsetVal);
                                                        else
                                                        {
                                                            fldOff = Globals.GetFieldIndex(inObject.Fields, args[1]);

                                                        }

                                                        Double.TryParse("1", out searchDistance);
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14av"));
                                                        continue;
                                                    }
                                                    if (intFldIdxs.Count != 2)
                                                    {
                                                        AAState.WriteLine( A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bn"));
                                                        continue;
                                                    }

                                                    // Get layer

                                                    for (int i = 0; i < sourceLayerNames.Length; i++)
                                                    {
                                                        sourceLayerName = sourceLayerNames[i].ToString();
                                                        if (sourceLayerName != "")

                                                            sourceLayerName = args[i].ToString();
                                                        if (i == 0)
                                                            i++;
                                                        boolLayerOrFC = true;

                                                        if (sourceLayerName.Contains("("))
                                                        {
                                                            string[] tempSplt = sourceLayerName.Split('(');
                                                            sourceLayerName = tempSplt[0];
                                                            sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);

                                                            if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                            {
                                                                boolLayerOrFC = true;
                                                            }
                                                            else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                            {
                                                                boolLayerOrFC = true;
                                                            }
                                                            else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                            {
                                                                boolLayerOrFC = false;
                                                            }
                                                            else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                            {
                                                                boolLayerOrFC = false;
                                                            }
                                                            else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                            {
                                                                boolLayerOrFC = false;
                                                            }
                                                            else
                                                            {
                                                                boolLayerOrFC = true;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);

                                                        }
                                                        if (sourceLayer == null)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14b") + sourceLayer + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                            continue;
                                                        }

                                                        IFeatureClass iFC = inFeature.Class as IFeatureClass;
                                                        if (sourceLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + sourceLayer + " is a polygon layer");

                                                            break;
                                                        }
                                                        if (sourceLayer != null)
                                                        {

                                                            sFilter = Globals.createSpatialFilter(sourceLayer, inFeature, searchDistance, false);

                                                            pFS = (IFeatureSelection)sourceLayer;
                                                            if (boolLayerOrFC)
                                                            {
                                                                if (pFS.SelectionSet.Count > 0)
                                                                {
                                                                    pFS.SelectionSet.Search(sFilter, true, out cCurs);
                                                                    fCursor = cCurs as IFeatureCursor;

                                                                }
                                                                else
                                                                {
                                                                    fCursor = sourceLayer.Search(sFilter, true);
                                                                }
                                                            }
                                                            else
                                                            {
                                                                fCursor = sourceLayer.FeatureClass.Search(sFilter, true);
                                                            }

                                                            while ((sourceFeature = fCursor.NextFeature()) != null)
                                                            {
                                                                double dAlong = 0;
                                                                if (sourceFeature.Class != inFeature.Class)
                                                                {
                                                                    IPoint pIntPnt;
                                                                    if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline)
                                                                    {
                                                                        pIntPnt = Globals.GetIntersection(inFeature.ShapeCopy, sourceFeature.ShapeCopy as IPolyline) as IPoint;

                                                                    }
                                                                    else
                                                                        pIntPnt = inFeature.ShapeCopy as IPoint;
                                                                    IPoint snapPnt = null;

                                                                    dAlong = Globals.PointDistanceOnLine(pIntPnt, sourceFeature.Shape as IPolyline, 2, out snapPnt);

                                                                    snapPnt = null;
                                                                    pIntPnt = null;

                                                                }

                                                                else if (sourceFeature.Class == inFeature.Class && sourceFeature.OID != inFeature.OID)
                                                                {
                                                                    IPoint pIntPnt;
                                                                    if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline)
                                                                    {
                                                                        pIntPnt = Globals.GetIntersection(inFeature.ShapeCopy, sourceFeature.ShapeCopy as IPolyline) as IPoint;

                                                                    }
                                                                    else
                                                                        pIntPnt = inFeature.ShapeCopy as IPoint;
                                                                    IPoint snapPnt = null;

                                                                    dAlong = Globals.PointDistanceOnLine(pIntPnt, sourceFeature.Shape as IPolyline, 2, out snapPnt);
                                                                    snapPnt = null;

                                                                    pIntPnt = null;

                                                                }
                                                                AAState.WriteLine("                     " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cc") + dAlong);
                                                                IPoint pNewPt = new PointClass();
                                                                IConstructPoint2 pConsPoint = pNewPt as IConstructPoint2;

                                                                if (fldOff != -1)
                                                                {
                                                                    string temp = inObject.get_Value(fldOff).ToString();
                                                                    if (Globals.IsNumeric(temp))
                                                                    {
                                                                        Double.TryParse(temp, out offsetVal);
                                                                    }

                                                                }
                                                                pConsPoint.ConstructOffset
                                                                    (sourceFeature.Shape as ICurve, esriSegmentExtension.esriNoExtension, dAlong, false, offsetVal);

                                                                inObject.set_Value(intFldIdxs[0], pNewPt.X);
                                                                inObject.set_Value(intFldIdxs[1], pNewPt.Y);

                                                                pNewPt = null;
                                                                pConsPoint = null;
                                                            }

                                                        }

                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "OFFSET: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "OFFSET");
                                            }
                                            break;

                                        case "SIDE":
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "SIDE");

                                                try
                                                {
                                                    //Layer|IDField|IDField source

                                                    if ((valData != null) && (inFeature != null))
                                                    {
                                                        AAState.WriteLine("                     " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cb"));

                                                        AAState.WriteLine("                     " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ca") + valData);
                                                        sourceLayerName = "";
                                                        sourceFieldName = "";
                                                        sourceField = -1;
                                                        string inputFieldName = "";
                                                        args = valData.Split('|');
                                                        if (args.Length < 2)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + "SIDE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bm"));
                                                            continue;
                                                        }

                                                        switch (args.Length)
                                                        {
                                                            case 3:
                                                                sourceLayerNames = args[0].ToString().Split(',');
                                                                sourceFieldName = args[1].ToString();
                                                                inputFieldName = args[2].ToString();
                                                                break;
                                                            default:
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + "SIDE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bm"));
                                                                continue;

                                                        }
                                                        int fldValToCopyIdx = inObject.Fields.FindField(inputFieldName);

                                                        if (fldValToCopyIdx > -1)
                                                        {

                                                            for (int i = 0; i < sourceLayerNames.Length; i++)
                                                            {
                                                                sourceLayerName = sourceLayerNames[i].ToString();

                                                                if (sourceLayerName != "")
                                                                {

                                                                    boolLayerOrFC = true;
                                                                    if (sourceLayerName.Contains("("))
                                                                    {
                                                                        string[] tempSplt = sourceLayerName.Split('(');
                                                                        sourceLayerName = tempSplt[0];
                                                                        sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);
                                                                        if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);
                                                                    }
                                                                    if (sourceLayer != null)
                                                                    {

                                                                        // Get layer
                                                                        AAState.WriteLine("                  " + sourceLayerName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bz"));
                                                                        int fldValTargetJoinIdx = Globals.GetFieldIndex(sourceLayer, sourceFieldName);
                                                                        if (fldValTargetJoinIdx > -1)
                                                                        {
                                                                            IQueryFilter pQFilt = Globals.createQueryFilter();

                                                                            if (sourceLayer.FeatureClass.Fields.get_Field(fldValTargetJoinIdx).Type == esriFieldType.esriFieldTypeString)
                                                                            {
                                                                                pQFilt.WhereClause = "" + sourceLayer.FeatureClass.Fields.get_Field(fldValTargetJoinIdx).Name + "" + " = '" + inObject.get_Value(fldValToCopyIdx).ToString() + "'";

                                                                            }
                                                                            else
                                                                            {
                                                                                pQFilt.WhereClause = sourceLayer.FeatureClass.Fields.get_Field(fldValTargetJoinIdx).Name + " = " + inObject.get_Value(fldValToCopyIdx);

                                                                            }
                                                                            AAState.WriteLine("                     " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bx") + pQFilt.WhereClause);
                                                                            int cnt = sourceLayer.FeatureClass.FeatureCount(pQFilt);
                                                                            AAState.WriteLine("                     " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14by") + cnt);
                                                                            if (cnt > 0)
                                                                            {

                                                                                fCursor = sourceLayer.FeatureClass.Search(pQFilt, true);
                                                                                while ((sourceFeature = fCursor.NextFeature()) != null)
                                                                                {
                                                                                    bool side = false;
                                                                                    if (Globals.GetPointOnLine(inFeature.Shape, sourceFeature.Shape, 450, out side) != null)
                                                                                    {

                                                                                        if (side)
                                                                                        {
                                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain38"));

                                                                                            inFeature.set_Value(intFldIdxs[0], "Right");
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain39"));
                                                                                            inFeature.set_Value(intFldIdxs[0], "Left");
                                                                                        }
                                                                                        if (fCursor != null)
                                                                                            Marshal.ReleaseComObject(fCursor);
                                                                                        fCursor = null;
                                                                                        continue;
                                                                                    }

                                                                                }
                                                                                if (fCursor != null)
                                                                                    Marshal.ReleaseComObject(fCursor);
                                                                                fCursor = null;
                                                                            }
                                                                            pQFilt = null;

                                                                        }

                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "SIDE" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    if (fCursor != null)
                                                        Marshal.ReleaseComObject(fCursor);
                                                    fCursor = null;

                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "SIDE");

                                                }
                                                break;

                                            }

                                        case "PROMPT":
                                            {
                                                //Loop through all fields list in the fieldname
                                                //If blank or null, prompt user for value
                                                //Store Value

                                                IDomain pDom = default(IDomain);
                                                ISubtypes pSubType = null;
                                                List<Globals.DomSubList> lst = null;

                                                Globals.DomSubList dmRetVal = null;

                                                try
                                                {
                                                    if ((inObject != null))
                                                    {

                                                        pSubType = (ISubtypes)inObject.Class;

                                                        if (pSubType.HasSubtype)
                                                        {
                                                            int intSub;
                                                            if (intFldIdxs.Contains(pSubType.SubtypeFieldIndex))
                                                            {
                                                                lst = Globals.SubtypeToList(pSubType);
                                                                if (inObject.get_Value(pSubType.SubtypeFieldIndex) == null || inObject.get_Value(pSubType.SubtypeFieldIndex) == "" || inObject.get_Value(pSubType.SubtypeFieldIndex) == DBNull.Value)
                                                                {
                                                                    dmRetVal = Globals.showValuesOptionsForm(lst, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + inObject.Class.AliasName + ":" + pSubType.SubtypeFieldName, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + inObject.Class.AliasName + ":" + pSubType.SubtypeFieldName, ComboBoxStyle.DropDownList);
                                                                    inObject.set_Value(pSubType.SubtypeFieldIndex, dmRetVal.Value);

                                                                    intSub = Convert.ToInt32(dmRetVal.Value);
                                                                }
                                                                else
                                                                {
                                                                    intSub = Convert.ToInt32(inObject.get_Value(pSubType.SubtypeFieldIndex));
                                                                }

                                                                for (int l = 0; l < strFldNames.Count; l++)
                                                                {
                                                                    if (intFldIdxs[l] == pSubType.SubtypeFieldIndex)
                                                                        continue;

                                                                    if (intFldIdxs[l] != -1)
                                                                    {
                                                                        pDom = pSubType.get_Domain(intSub, inObject.Fields.get_Field(intFldIdxs[l]).Name);

                                                                        if (pDom == null)
                                                                        {
                                                                            if (inObject.get_Value(intFldIdxs[l]) == null || inObject.get_Value(intFldIdxs[l]) == "" || inObject.get_Value(intFldIdxs[l]) == DBNull.Value)
                                                                            {
                                                                                IList<string> pVals = new List<string>();

                                                                                string strRetVal = Globals.showValuesOptionsForm(pVals, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + inObject.Class.AliasName + ":" + strFldAlias[l], A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + inObject.Class.AliasName + ":" + strFldAlias[l], ComboBoxStyle.DropDown);

                                                                                try
                                                                                {
                                                                                    inObject.set_Value(intFldIdxs[l], strRetVal);
                                                                                }
                                                                                catch
                                                                                {

                                                                                }
                                                                                pVals = null;
                                                                            }

                                                                        }
                                                                        else
                                                                        {

                                                                            if (pDom is CodedValueDomain)
                                                                            {

                                                                                lst = Globals.DomainToList(pDom);
                                                                                if (inObject.get_Value(intFldIdxs[l]) == null || inObject.get_Value(intFldIdxs[l]) == "" || inObject.get_Value(intFldIdxs[l]) == DBNull.Value)
                                                                                {

                                                                                    dmRetVal = Globals.showValuesOptionsForm(lst, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], ComboBoxStyle.DropDownList);
                                                                                    try
                                                                                    {
                                                                                        inObject.set_Value(intFldIdxs[l], dmRetVal.Value);
                                                                                    }
                                                                                    catch
                                                                                    {

                                                                                    }

                                                                                    lst = null;
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                if (inObject.get_Value(intFldIdxs[l]) == null || inObject.get_Value(intFldIdxs[l]) == "" || inObject.get_Value(intFldIdxs[l]) == DBNull.Value)
                                                                                {

                                                                                    IList<string> pVals = new List<string>();
                                                                                    string strRetVal = Globals.showValuesOptionsForm(pVals, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], ComboBoxStyle.DropDown);

                                                                                    try
                                                                                    {
                                                                                        inObject.set_Value(intFldIdxs[l], strRetVal);
                                                                                    }
                                                                                    catch
                                                                                    {

                                                                                    }

                                                                                    pVals = null;
                                                                                }
                                                                            }

                                                                        }

                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  PROMPT: " + strFldNames[l] + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                    }
                                                                }

                                                            }
                                                            else
                                                            {
                                                                if (inObject.get_Value(pSubType.SubtypeFieldIndex) == null)
                                                                    intSub = pSubType.DefaultSubtypeCode;
                                                                else

                                                                    intSub = Convert.ToInt32(inObject.get_Value(pSubType.SubtypeFieldIndex));
                                                                for (int l = 0; l < strFldNames.Count; l++)
                                                                {
                                                                    if (intFldIdxs[l] != -1)
                                                                    {
                                                                        pDom = pSubType.get_Domain(intSub, inObject.Fields.get_Field(intFldIdxs[l]).Name);

                                                                        if (pDom == null)
                                                                        {
                                                                            if (inObject.get_Value(intFldIdxs[l]) == null || inObject.get_Value(intFldIdxs[l]) == "" || inObject.get_Value(intFldIdxs[l]) == DBNull.Value)
                                                                            {

                                                                                IList<string> pVals = new List<string>();
                                                                                string strRetVal = Globals.showValuesOptionsForm(pVals, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], ComboBoxStyle.DropDown);

                                                                                try
                                                                                {
                                                                                    inObject.set_Value(intFldIdxs[l], strRetVal);
                                                                                }
                                                                                catch
                                                                                {

                                                                                }

                                                                                pVals = null;
                                                                            }
                                                                        }
                                                                        else
                                                                        {

                                                                            if (pDom is CodedValueDomain)
                                                                            {
                                                                                if (inObject.get_Value(intFldIdxs[l]) == null || inObject.get_Value(intFldIdxs[l]) == "" || inObject.get_Value(intFldIdxs[l]) == DBNull.Value)
                                                                                {

                                                                                    lst = Globals.DomainToList(pDom);

                                                                                    dmRetVal = Globals.showValuesOptionsForm(lst, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], ComboBoxStyle.DropDownList);
                                                                                    try
                                                                                    {
                                                                                        inObject.set_Value(intFldIdxs[l], dmRetVal.Value);
                                                                                    }
                                                                                    catch
                                                                                    {

                                                                                    }

                                                                                    lst = null;
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                if (inObject.get_Value(intFldIdxs[l]) == null || inObject.get_Value(intFldIdxs[l]) == "" || inObject.get_Value(intFldIdxs[l]) == DBNull.Value)
                                                                                {

                                                                                    IList<string> pVals = new List<string>();
                                                                                    string strRetVal = Globals.showValuesOptionsForm(pVals, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], ComboBoxStyle.DropDown);

                                                                                    try
                                                                                    {
                                                                                        inObject.set_Value(intFldIdxs[l], strRetVal);
                                                                                    }
                                                                                    catch
                                                                                    {

                                                                                    }

                                                                                    pVals = null;
                                                                                }
                                                                            }

                                                                        }

                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  PROMPT: " + strFldNames[l] + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                    }
                                                                }

                                                            }
                                                        }
                                                        else
                                                        {
                                                            for (int l = 0; l < strFldNames.Count; l++)
                                                            {

                                                                if (intFldIdxs[l] != -1)
                                                                {

                                                                    pDom = inObject.Fields.get_Field(intFldIdxs[l]).Domain;
                                                                    if (pDom == null)
                                                                    {
                                                                        if (inObject.get_Value(intFldIdxs[l]) == null || inObject.get_Value(intFldIdxs[l]) == "" || inObject.get_Value(intFldIdxs[l]) == DBNull.Value)
                                                                        {

                                                                            IList<string> pVals = new List<string>();
                                                                            string strRetVal = Globals.showValuesOptionsForm(pVals, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], ComboBoxStyle.DropDown);
                                                                            try
                                                                            {
                                                                                inObject.set_Value(intFldIdxs[l], strRetVal);
                                                                            }
                                                                            catch
                                                                            {

                                                                            }

                                                                            pVals = null;
                                                                        }
                                                                    }
                                                                    else
                                                                    {

                                                                        if (pDom is CodedValueDomain)
                                                                        {
                                                                            if (inObject.get_Value(intFldIdxs[l]) == null || inObject.get_Value(intFldIdxs[l]) == "" || inObject.get_Value(intFldIdxs[l]) == DBNull.Value)
                                                                            {

                                                                                lst = Globals.DomainToList(pDom);

                                                                                dmRetVal = Globals.showValuesOptionsForm(lst, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], ComboBoxStyle.DropDownList);
                                                                                try
                                                                                {
                                                                                    inObject.set_Value(intFldIdxs[l], dmRetVal.Value);
                                                                                }
                                                                                catch
                                                                                {

                                                                                }

                                                                                lst = null;
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            if (inObject.get_Value(intFldIdxs[l]) == null || inObject.get_Value(intFldIdxs[l]) == "" || inObject.get_Value(intFldIdxs[l]) == DBNull.Value)
                                                                            {

                                                                                IList<string> pVals = new List<string>();
                                                                                string strRetVal = Globals.showValuesOptionsForm(pVals, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bw") + strFldAlias[l], ComboBoxStyle.DropDown);
                                                                                try
                                                                                {
                                                                                    inObject.set_Value(intFldIdxs[l], strRetVal);
                                                                                }
                                                                                catch
                                                                                {

                                                                                }
                                                                                pVals = null;
                                                                            }
                                                                        }

                                                                    }

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  PROMPT: " + strFldNames[l] + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                }
                                                            }
                                                        }

                                                    }
                                                }

                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "PROMPT" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {

                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "PROMPT");
                                                    pDom = null;
                                                    pSubType = null;
                                                    lst = null;

                                                    dmRetVal = null;
                                                }
                                                break;
                                            }

                                        case "CASCADE_ATTRIBUTE":
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "CASCADE_ATTRIBUTE");

                                                string flds;
                                                string targetLayer;
                                                IRowChanges pRowCh = null;

                                                try
                                                {

                                                    if ((valData != null) && (inObject != null))
                                                    {
                                                        AAState.WriteLine("                     " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cb"));

                                                        AAState.WriteLine("                     " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ca") + valData);
                                                        //field name is the field to Check
                                                        //value|Layer|tempalte|Cut or Copy|field-toField
                                                        args = valData.Split('|');
                                                        if (args.Length < 2)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "CASCADE_ATTRIBUTE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bl"));
                                                            continue;
                                                        }

                                                        targetLayer = args[0];
                                                        flds = args[1];
                                                        bool bPrompt;
                                                        if (args.Length == 3)
                                                        {
                                                            if (args[2].ToUpper() == "T" || args[2].ToUpper() == "TRUE" || args[2].ToUpper() == "YES")
                                                            {
                                                                bPrompt = true;
                                                            }
                                                            else
                                                            {
                                                                bPrompt = false;
                                                            }

                                                        }
                                                        else
                                                        {
                                                            bPrompt = true;
                                                        }
                                                        pRowCh = inObject as IRowChanges;
                                                        if (pRowCh.get_ValueChanged(intFldIdxs[0]) == false)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "CASCADE_ATTRIBUTE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bk"));
                                                            continue;
                                                        }

                                                        bool boolFoundAsLayer = true;

                                                        sourceLayer = Globals.FindLayer(ArcMap.Application, args[0].ToString(), ref boolFoundAsLayer) as IFeatureLayer;
                                                        if (sourceLayer == null)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "CASCADE_ATTRIBUTE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bj"));
                                                            continue;
                                                        }
                                                        int intTargFld = -1;
                                                        intTargFld = sourceLayer.FeatureClass.Fields.FindField(flds);
                                                        if (intTargFld == -1)
                                                        {
                                                            intTargFld = sourceLayer.FeatureClass.Fields.FindFieldByAliasName(flds);
                                                            if (intTargFld != -1)
                                                            {
                                                                flds = sourceLayer.FeatureClass.Fields.get_Field(intTargFld).Name;

                                                            }
                                                        }
                                                        if (intTargFld > -1)
                                                        {
                                                            bool proceed = true;

                                                            if (pRowCh.get_OriginalValue(intFldIdxs[0]).ToString().Trim() == "")
                                                                continue;
                                                            IQueryFilter pQFilt = new QueryFilterClass();
                                                            if (sourceLayer.FeatureClass.Fields.get_Field(intTargFld).Type == esriFieldType.esriFieldTypeString)
                                                            {
                                                                pQFilt.WhereClause = flds + " = '" + pRowCh.get_OriginalValue(intFldIdxs[0]) + "'";

                                                            }
                                                            else
                                                            {
                                                                pQFilt.WhereClause = flds + " = " + pRowCh.get_OriginalValue(intFldIdxs[0]) + "";

                                                            }

                                                            int featCnt = sourceLayer.FeatureClass.FeatureCount(pQFilt);
                                                            if (featCnt == 0)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain40"));

                                                            }
                                                            else
                                                            {
                                                                string promptLayname;

                                                                promptLayname = Globals.getClassName(sourceLayer);

                                                                if (bPrompt)
                                                                {
                                                                    if (MessageBox.Show("You are about to change " + featCnt + " rows in the " + promptLayname + " Feature Class, proceed?", "Cascade", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain41"));

                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain42"));
                                                                        proceed = false;

                                                                    }

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain43"));
                                                                }
                                                                if (proceed)
                                                                {
                                                                    IFeatureCursor pCalcCursor = sourceLayer.FeatureClass.Update(pQFilt, false);
                                                                    IFeature updateFeat;
                                                                    if (ChangeFeatureList == null)
                                                                    {
                                                                        ChangeFeatureList = new List<IObject>();
                                                                    }
                                                                    while ((updateFeat = pCalcCursor.NextFeature()) != null)
                                                                    {

                                                                        updateFeat.set_Value(intTargFld, inObject.get_Value(intFldIdxs[0]));
                                                                        ChangeFeatureList.Add(updateFeat);

                                                                        //if (!trackCancel.Continue())
                                                                        //{
                                                                        //    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain19"));
                                                                        //    AAState._editor.AbortOperation();
                                                                        //    return false;
                                                                        //}
                                                                    }
                                                                    updateFeat = null;

                                                                    if (pCalcCursor != null)
                                                                    {
                                                                        Marshal.ReleaseComObject(pCalcCursor);
                                                                    }
                                                                    pCalcCursor = null;

                                                                    pQFilt = null;
                                                                }
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "CASCADE_ATTRIBUTE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bi"));
                                                        }

                                                    }
                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "CASCADE_ATTRIBUTE" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    sourceLayer = null;

                                                    pRowCh = null;
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "CASCADE_ATTRIBUTE");
                                                }
                                                break;
                                            }

                                        case "COPY_FEATURE":
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "COPY_FEATURE");
                                                IFeatureLayer pTargetFL;
                                                string[] FldPairs;
                                                string targetValue;
                                                IRowChanges pRowCh = null;
                                                IFeature pNewFeat = null;
                                                try
                                                {

                                                    if ((valData != null) && (inFeature != null))
                                                    {
                                                        AAState.WriteLine("                     " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cb"));

                                                        AAState.WriteLine("                     " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ca") + valData);
                                                        //field name is the field to Check
                                                        //value|Layer|tempalte|Cut or Copy|field-toField
                                                        args = valData.Split('|');
                                                        if (args.Length < 2)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "COPY_FEATURE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bh"));
                                                            continue;
                                                        }

                                                        targetValue = args[0];
                                                        pRowCh = inObject as IRowChanges;

                                                        if (intFldIdxs.Count > 0)
                                                        {
                                                       if (pRowCh.get_ValueChanged(intFldIdxs[0]) == false && mode != "ON_CREATE")
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain44"));
                                                            continue;
                                                        }

                                                            if (inFeature.get_Value(intFldIdxs[0]).ToString() != targetValue.ToString())
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain45"));
                                                                continue;
                                                            }
                                                        }

                                                        bool FCorLayerTarget = true;

                                                        pTargetFL = Globals.FindLayer(ArcMap.Application, args[1].ToString(), ref FCorLayerTarget) as IFeatureLayer;
                                                        if (pTargetFL == null)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "COPY_FEATURE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bg"));
                                                            continue;
                                                        }
                                                        if (Globals.IsEditable(ref pTargetFL, ref AAState._editor) == false)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "COPY_FEATURE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14be"));
                                                            continue;
                                                        }

                                                        if (pTargetFL.FeatureClass.ShapeType != (inFeature.Class as IFeatureClass).ShapeType)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "COPY_FEATURE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bf"));
                                                            continue;
                                                        }

                                                        FldPairs = null;
                                                        //value|Layer|tempalte|Cut or Copy|field-toField

                                                        IEditTemplate pEditTemp = null;
                                                        string sourceAction = "COPY";
                                                        string fldMatching = null;

                                                        switch (args.Length)
                                                        {
                                                            //case 2:

                                                            //    break;
                                                            case 3:
                                                                if (args[2].Trim() != "")
                                                                {
                                                                    pEditTemp = Globals.PromptAndGetEditTemplateGraphic(pTargetFL, args[2].Trim());

                                                                }
                                                                else
                                                                {
                                                                    pEditTemp = null;
                                                                }
                                                                break;
                                                            case 4:
                                                                if (args[2].Trim() != "")
                                                                {

                                                                    pEditTemp = Globals.PromptAndGetEditTemplateGraphic(pTargetFL, args[2].Trim());
                                                                }
                                                                else
                                                                {
                                                                    pEditTemp = null;
                                                                }
                                                                sourceAction = args[3].ToUpper().Trim();

                                                                break;
                                                            case 5:
                                                                if (args[2].Trim() != "")
                                                                {

                                                                    pEditTemp = Globals.PromptAndGetEditTemplateGraphic(pTargetFL, args[2].Trim());
                                                                }
                                                                else
                                                                {
                                                                    pEditTemp = null;
                                                                }
                                                                sourceAction = args[3].ToUpper().Trim();
                                                                fldMatching = args[4].Trim();
                                                                break;
                                                        }

                                                        if (pEditTemp != null)
                                                        {

                                                            pNewFeat = Globals.CreateFeature(inFeature.ShapeCopy, pEditTemp, AAState._editor, ArcMap.Application, false, false, false);

                                                        }
                                                        else
                                                        {
                                                            pNewFeat = Globals.CreateFeature(inFeature.ShapeCopy, pTargetFL, AAState._editor, ArcMap.Application, false, false, false);

                                                        }
                                                        pEditTemp = null;
                                                        if (fldMatching != null)
                                                        {
                                                            if (fldMatching == "")
                                                            {
                                                                FldPairs = new string[] { };
                                                            }
                                                            else
                                                            {
                                                                FldPairs = fldMatching.Split(',');
                                                            }
                                                        }
                                                        else
                                                        {
                                                            FldPairs = new string[] { };

                                                        }

                                                        List<string> targFilds = new List<string>();

                                                        foreach (string strFlpPair in FldPairs)
                                                        {
                                                            string[] fldMatch = strFlpPair.Split('-');
                                                            if (fldMatch.Length != 2)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "COPY_FEATURE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bd"));
                                                            }
                                                            else
                                                            {
                                                                string strSrcFldName = fldMatch[0];
                                                                string strTarFldName = fldMatch[1];
                                                                int intSrcFldIdx = Globals.GetFieldIndex((inFeature.Class as IFeatureClass).Fields, (strSrcFldName));
                                                                int intTarFldIdx = Globals.GetFieldIndex(pTargetFL.FeatureClass.Fields, strTarFldName);
                                                                if (intSrcFldIdx == -1 || intTarFldIdx == -1)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "COPY_FEATURE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bc"));
                                                                }
                                                                else
                                                                {
                                                                    targFilds.Add(strTarFldName.ToUpper());

                                                                    try
                                                                    {
                                                                        pNewFeat.set_Value(intTarFldIdx, inFeature.get_Value(intSrcFldIdx));
                                                                    }
                                                                    catch
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "COPY_FEATURE: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14bb") + strFlpPair);

                                                                    }
                                                                }

                                                            }
                                                        }
                                                        IFields pTarFields = pTargetFL.FeatureClass.Fields;
                                                        IField pTarField = null;
                                                        for (int i = 0; i < pTarFields.FieldCount; i++)
                                                        {
                                                            pTarField = pTarFields.get_Field(i);
                                                            if (pTarField.Type != esriFieldType.esriFieldTypeGlobalID &&
                                                                pTarField.Type != esriFieldType.esriFieldTypeOID &&
                                                                pTarField.Type != esriFieldType.esriFieldTypeGeometry &&
                                                                 pTarField.Name.ToUpper() != "SHAPE_LENGTH" &&
                                                                pTarField.Name.ToUpper() != "SHAPE.LEN" &&
                                                                pTarField.Name.ToUpper() != "SHAPE_AREA" &&
                                                                pTarField.Name.ToUpper() != "SHAPE.AREA")
                                                            {
                                                                if (targFilds.Contains(pTarField.Name.ToUpper()) == false)
                                                                {
                                                                    int fldIdx = inFeature.Fields.FindField(pTarField.Name);
                                                                    if (fldIdx > 0)
                                                                    {
                                                                        try
                                                                        {
                                                                            pNewFeat.set_Value(i, inFeature.get_Value(fldIdx));
                                                                        }
                                                                        catch
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain46") + pTarField.Name);

                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }

                                                        pTarFields = null;
                                                        pTarField = null;
                                                        if (NewFeatureList == null)
                                                        {
                                                            NewFeatureList = new List<IObject>();
                                                        }

                                                        NewFeatureList.Add(pNewFeat);

                                                        if (sourceAction == "CUT")
                                                        {
                                                            MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain47"));

                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain48"));

                                                    }
                                                }

                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "COPY_FEATURE" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    pTargetFL = null;

                                                    pRowCh = null;
                                                    pNewFeat = null;
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "COPY_FEATURE");
                                                }
                                                break;
                                            }

                                        case "VALIDATE_CONNECTIVITY":
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "VALIDATE_CONNECTIVITY");

                                                try
                                                {

                                                    if ((valData != null) && (inFeature != null))
                                                    {
                                                        AAState.WriteLine("                     " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cb"));

                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain49"));
                                                        bool validFeat = false;
                                                        if (inFeature is INetworkFeature)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain50"));

                                                            AAState.WriteLine("                     " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ca") + valData);

                                                            args = valData.Split('|');
                                                            int connectionCnt = Globals.getConnectionCount(inFeature);

                                                            foreach (string fldConPair in args)
                                                            {

                                                                string[] fldCon = fldConPair.Split(',');
                                                                if (fldCon.Length == 1)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain51"));
                                                                    if (Globals.IsNumeric(fldCon[0]))
                                                                    {
                                                                        if (connectionCnt == Convert.ToInt32(fldCon[0]))
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain52"));
                                                                            validFeat = true;
                                                                            break;

                                                                        }

                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain53"));
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    if (intFldIdxs.Count == 0)
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain51"));
                                                                        if (fldCon.Length == 2)
                                                                        {
                                                                            if (connectionCnt == Convert.ToInt32(fldCon[1]))
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain52"));
                                                                                validFeat = true;
                                                                                break;

                                                                            }
                                                                        }
                                                                        if (fldCon.Length > 2)
                                                                        {
                                                                            if (connectionCnt >= Convert.ToInt32(fldCon[1]) && connectionCnt <= Convert.ToInt32(fldCon[2]))
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain52"));
                                                                                validFeat = true;
                                                                                break;

                                                                            }
                                                                        }

                                                                    }

                                                                    else if (inFeature.get_Value(intFldIdxs[0]).ToString() == fldCon[0])
                                                                    {

                                                                        if (fldCon.Length == 2)
                                                                        {
                                                                            if (connectionCnt == Convert.ToInt32(fldCon[1]))
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain52"));
                                                                                validFeat = true;
                                                                                break;

                                                                            }
                                                                        }
                                                                        if (fldCon.Length > 2)
                                                                        {
                                                                            if (connectionCnt >= Convert.ToInt32(fldCon[1]) && connectionCnt <= Convert.ToInt32(fldCon[2]))
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain52"));
                                                                                validFeat = true;
                                                                                break;

                                                                            }
                                                                        }

                                                                    }

                                                                }

                                                            }
                                                            if (validFeat == false)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain19"));
                                                                AAState._editor.AbortOperation();
                                                                return false;

                                                            }
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain54"));

                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain48"));

                                                    }
                                                }

                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "VALIDATE_CONNECTIVITY" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "VALIDATE_CONNECTIVITY");
                                                }
                                                break;
                                            }

                                        case "VALIDATE_ATTRIBUTES":
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "VALIDATE_ATTRIBUTES");

                                                try
                                                {
                                                    if ((valData != null) && (inFeature != null))
                                                    {

                                                        AAState.WriteLine("                     " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cb"));
                                                        IRowChanges pRowCh = inObject as IRowChanges;
                                                        changed = true;
                                                        if (intFldIdxs != null && intFldIdxs.Count > 0 && mode != "ON_CREATE")
                                                        {
                                                            for (int fldIdx = 0; fldIdx < intFldIdxs.Count; fldIdx++)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain55"));
                                                                changed = pRowCh.get_ValueChanged(intFldIdxs[fldIdx]);
                                                                AAState.WriteLine("                     " + strFldNames[fldIdx] + " changed value was " + changed);
                                                                if (changed)
                                                                    break;
                                                            }

                                                        }
                                                        if (changed)
                                                        {
                                                            args = valData.Split('|');
                                                            args = args[0].Split(',');
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain56") + args);
                                                            if (args.Length > 0)
                                                            {

                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain57"));
                                                                IList<ILayer> pLayList = Globals.FindLayersByClassID(((IMxDocument)ArcMap.Application.Document).FocusMap, inObject.Class.ObjectClassID);
                                                                if (pLayList != null)
                                                                {
                                                                    if (pLayList.Count > 0)
                                                                    {

                                                                        AAState.WriteLine("                     " + pLayList.Count + " Layers found");
                                                                        bool ValidComb = false;

                                                                        foreach (ILayer pLay in pLayList)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain58") + pLay.Name);
                                                                            if (pLay is IFeatureLayer)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain59"));

                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain60"));
                                                                                IEditTemplateManager pEdTmpManager = Globals.GetEditTemplateManager((IFeatureLayer)pLay);
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain61"));
                                                                                ValidComb = Globals.FeatureIsValidTemplate(pEdTmpManager, inFeature, args);
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain62") + ValidComb.ToString());
                                                                                if (ValidComb == true)
                                                                                    break;

                                                                            }

                                                                        }
                                                                        if (ValidComb == false)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain19"));
                                                                            AAState._editor.AbortOperation();
                                                                            return false;

                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain63"));

                                                                    }

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain63"));

                                                                }

                                                            }
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain64"));

                                                        }
                                                    }
                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "VALIDATE_ATTRIBUTES" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "VALIDATE_ATTRIBUTES");
                                                }
                                                break;
                                            }

                                        case "SPLIT_INTERSECTING_FEATURE":
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "SPLIT_INTERSECTING_FEATURE");

                                                try
                                                {
                                                    if ((valData != null) && (inFeature != null))
                                                    {
                                                        intersectLayerName = "";
                                                        intersectLayer = null;
                                                        args = valData.Split('|');
                                                        if (args.Length > 0)
                                                        {
                                                            AAState.WriteLine("                  " + args.Length + " Layers listed ");

                                                            for (int i = 0; i < args.Length; i++)
                                                            {

                                                                intersectLayerName = args[i].Trim();
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain65") + intersectLayerName);
                                                                boolLayerOrFC = true;
                                                                if (intersectLayerName.Contains("("))
                                                                {
                                                                    string[] tempSplt = intersectLayerName.Split('(');
                                                                    intersectLayerName = tempSplt[0];
                                                                    intersectLayer = Globals.FindLayer(AAState._editor.Map, intersectLayerName, ref boolLayerOrFC) as IFeatureLayer;
                                                                    if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                                    {
                                                                        boolLayerOrFC = true;
                                                                    }
                                                                    else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                                    {
                                                                        boolLayerOrFC = true;
                                                                    }
                                                                    else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                                    {
                                                                        boolLayerOrFC = false;
                                                                    }
                                                                    else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                                    {
                                                                        boolLayerOrFC = false;
                                                                    }
                                                                    else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                                    {
                                                                        boolLayerOrFC = false;
                                                                    }
                                                                    else
                                                                    {
                                                                        boolLayerOrFC = true;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    intersectLayer = Globals.FindLayer(AAState._editor.Map, intersectLayerName, ref boolLayerOrFC) as IFeatureLayer;
                                                                }
                                                                if (intersectLayer != null)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain66") + intersectLayerName);
                                                                    if (intersectLayer.FeatureClass != null)
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain67") + intersectLayerName);
                                                                        double snapTol = Globals.GetXYTolerance(intersectLayer);
                                                                        sFilter = Globals.createSpatialFilter(intersectLayer, inFeature, false);

                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain68"));

                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain69") + intersectLayerName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain70"));

                                                                        pFS = (IFeatureSelection)intersectLayer;
                                                                        if (boolLayerOrFC)
                                                                        {
                                                                            if (pFS.SelectionSet.Count > 0)
                                                                            {
                                                                                pFS.SelectionSet.Search(sFilter, true, out cCurs);
                                                                                fCursor = cCurs as IFeatureCursor;

                                                                            }
                                                                            else
                                                                            {
                                                                                fCursor = intersectLayer.Search(sFilter, true);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            fCursor = intersectLayer.FeatureClass.Search(sFilter, true);
                                                                        }

                                                                        IFeature intsersectFeature;
                                                                        int idx = 1;
                                                                        while ((intsersectFeature = fCursor.NextFeature()) != null)
                                                                        {
                                                                            if (intsersectFeature.Class != inFeature.Class)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain71") + idx);
                                                                                idx++;

                                                                                if (intsersectFeature is INetworkFeature)
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain72"));
                                                                                }
                                                                                else
                                                                                {
                                                                                    ISet featset = Globals.splitLineWithPoint(intsersectFeature, inFeature.ShapeCopy as IPoint, snapTol, null, "{0:0.00}", ArcMap.Application);

                                                                                    if (featset != null)
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain73"));

                                                                                        if (featset.Count > 0)
                                                                                        {
                                                                                            if (NewFeatureList == null)
                                                                                            {
                                                                                                NewFeatureList = new List<IObject>();
                                                                                            }
                                                                                            object featobj;
                                                                                            while ((featobj = featset.Next()) != null)
                                                                                            {
                                                                                                IFeature feature = featobj as IFeature;

                                                                                                if (feature != null)
                                                                                                {
                                                                                                    NewFeatureList.Add(feature as IObject);
                                                                                                }
                                                                                                feature = null;
                                                                                            }

                                                                                        }
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain74") + intersectLayerName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain75") + featset.Count);
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain76"));

                                                                                    }
                                                                                    featset = null;
                                                                                }
                                                                            }
                                                                            if (intsersectFeature != null)
                                                                            {
                                                                                Marshal.ReleaseComObject(intsersectFeature);
                                                                            }

                                                                            else if (intsersectFeature.Class == inFeature.Class && intsersectFeature.OID != inFeature.OID)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain71") + idx);
                                                                                idx++;
                                                                                if (intsersectFeature is INetworkFeature)
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain72"));
                                                                                }
                                                                                else
                                                                                {
                                                                                    ISet featset = Globals.splitLineWithPoint(intsersectFeature, inFeature.ShapeCopy as IPoint, snapTol, null, "{0:0.00}", ArcMap.Application);

                                                                                    if (featset == null)
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain77"));

                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain73"));

                                                                                        if (featset.Count > 0)
                                                                                        {
                                                                                            if (NewFeatureList == null)
                                                                                            {
                                                                                                NewFeatureList = new List<IObject>();
                                                                                            }
                                                                                            object featobj;
                                                                                            while ((featobj = featset.Next()) != null)
                                                                                            {
                                                                                                IFeature feature = featobj as IFeature;
                                                                                                if (feature != null)
                                                                                                {
                                                                                                    NewFeatureList.Add(feature as IObject);
                                                                                                }
                                                                                                feature = null;

                                                                                            }

                                                                                        }
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain74") + intersectLayerName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain75") + featset.Count);
                                                                                    }
                                                                                    featset = null;

                                                                                }
                                                                                if (intsersectFeature != null)
                                                                                {
                                                                                    Marshal.ReleaseComObject(intsersectFeature);
                                                                                }

                                                                            }

                                                                        }
                                                                        intsersectFeature = null;
                                                                    }
                                                                }

                                                                else
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain78") + intersectLayerName);
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14l") + valData);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14m"));
                                                    }
                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "SPLIT_INTERSECTING_FEATURE" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "SPLIT_INTERSECTING_FEATURE");
                                                }
                                                break;
                                            }

                                        case "NEAREST_FEATURE_ATTRIBUTES":
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "NEAREST_FEATURE_ATTRIBUTES");
                                                try
                                                {
                                                    if ((valData != null) && (inFeature != null))
                                                    {
                                                        sourceLayerName = "";
                                                        string[] sourceFieldNames = null;
                                                        string[] destFieldNames = null;
                                                        searchDistance = 0;

                                                        // Parse arguments
                                                        args = valData.Split('|');
                                                        if (args.Length == 3)
                                                        {
                                                            sourceLayerName = args[0].ToString().Trim();
                                                            sourceFieldNames = args[1].ToString().Split(',');
                                                            destFieldNames = args[2].ToString().Split(',');
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain79"));

                                                        }
                                                        else if (args.Length == 4)
                                                        {
                                                            sourceLayerName = args[0].ToString().Trim();
                                                            sourceFieldNames = args[1].ToString().Split(',');
                                                            destFieldNames = args[2].ToString().Split(',');
                                                            Double.TryParse(args[3], out searchDistance);
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14d"));
                                                            continue;

                                                        }

                                                        if ((sourceFieldNames != null) && (destFieldNames != null) &&
                                                            (sourceFieldNames.Length > 0) && (destFieldNames.Length > 0) &&
                                                            (sourceFieldNames.Length == destFieldNames.Length))
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain13") + sourceLayerName);

                                                            boolLayerOrFC = true;
                                                            if (sourceLayerName.Contains("("))
                                                            {
                                                                string[] tempSplt = sourceLayerName.Split('(');
                                                                sourceLayerName = tempSplt[0];
                                                                sourceLayer = Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC) as IFeatureLayer;
                                                                if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                                {
                                                                    boolLayerOrFC = true;
                                                                }
                                                                else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                                {
                                                                    boolLayerOrFC = true;
                                                                }
                                                                else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                                {
                                                                    boolLayerOrFC = false;
                                                                }
                                                                else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                                {
                                                                    boolLayerOrFC = false;
                                                                }
                                                                else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                                {
                                                                    boolLayerOrFC = false;
                                                                }
                                                                else
                                                                {
                                                                    boolLayerOrFC = true;
                                                                }
                                                            }

                                                            else
                                                            {
                                                                sourceLayer = Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC) as IFeatureLayer;
                                                            }
                                                            if (sourceLayer != null)
                                                            {
                                                                if (sourceLayer.FeatureClass != null)
                                                                {
                                                                    AAState.WriteLine("                  " + sourceLayer.Name + " layer Found: " + sourceLayerName);

                                                                    string missingFieldMess = null;
                                                                    int[] sourceFieldNums = new int[sourceFieldNames.Length];
                                                                    int[] destFieldNums = new int[destFieldNames.Length];
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain80"));

                                                                    for (int i = 0; i < sourceFieldNums.Length; i++)
                                                                    {
                                                                        int fnum = sourceLayer.FeatureClass.FindField(sourceFieldNames[i].Trim());
                                                                        if (fnum < 0)
                                                                        {
                                                                            missingFieldMess = sourceFieldNames[i].Trim() + " in table " + sourceLayerName;
                                                                            break;
                                                                        }
                                                                        sourceFieldNums[i] = fnum;
                                                                    }
                                                                    if (missingFieldMess == null)
                                                                    {
                                                                        for (int i = 0; i < destFieldNums.Length; i++)
                                                                        {
                                                                            int fnum = inFeature.Fields.FindField(destFieldNames[i].Trim());
                                                                            if (fnum < 0)
                                                                            {
                                                                                missingFieldMess = destFieldNames[i].Trim() + " in table " + tableName;
                                                                                break;
                                                                            }
                                                                            destFieldNums[i] = fnum;
                                                                        }
                                                                    }
                                                                    if (missingFieldMess == null)
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain81"));

                                                                        // found source and destination fields.

                                                                        if (searchDistance > 0)
                                                                        {
                                                                            sFilter = Globals.createSpatialFilter(sourceLayer, inFeature, searchDistance, false);

                                                                        }
                                                                        else
                                                                        {
                                                                            sFilter = Globals.createSpatialFilter(sourceLayer, inFeature, searchDistance, false);

                                                                        }

                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain82"));

                                                                        pFS = (IFeatureSelection)sourceLayer;
                                                                        if (boolLayerOrFC)
                                                                        {
                                                                            if (pFS.SelectionSet.Count > 0)
                                                                            {
                                                                                pFS.SelectionSet.Search(sFilter, false, out cCurs);
                                                                                fCursor = cCurs as IFeatureCursor;

                                                                            }
                                                                            else
                                                                            {
                                                                                fCursor = sourceLayer.Search(sFilter, false);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            fCursor = sourceLayer.FeatureClass.Search(sFilter, false);
                                                                        }

                                                                        sourceFeature = fCursor.NextFeature();
                                                                        nearestFeature = null;

                                                                        proxOp = (IProximityOperator)inFeature.Shape;
                                                                        lastDistance = searchDistance;
                                                                        if (sourceFeature != null)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain83"));

                                                                            while (sourceFeature != null)
                                                                            {
                                                                                if (sourceFeature.Class != inFeature.Class)
                                                                                {

                                                                                    IGeometry pTempGeo = sourceFeature.ShapeCopy;
                                                                                    pTempGeo.Project(inFeature.Shape.SpatialReference);

                                                                                    distance = proxOp.ReturnDistance(pTempGeo);
                                                                                    pTempGeo = null;
                                                                                    if (distance <= lastDistance)
                                                                                    {
                                                                                        nearestFeature = sourceFeature;
                                                                                        lastDistance = distance;
                                                                                    }
                                                                                }
                                                                                else if (sourceFeature.Class == inFeature.Class && sourceFeature.OID != inFeature.OID)
                                                                                {

                                                                                    IGeometry pTempGeo = sourceFeature.ShapeCopy;
                                                                                    pTempGeo.Project(inFeature.Shape.SpatialReference);

                                                                                    distance = proxOp.ReturnDistance(pTempGeo);
                                                                                    pTempGeo = null;
                                                                                    if (distance <= lastDistance)
                                                                                    {
                                                                                        nearestFeature = sourceFeature;
                                                                                        lastDistance = distance;
                                                                                    }
                                                                                }
                                                                                sourceFeature = fCursor.NextFeature();
                                                                            }
                                                                        }
                                                                        if (nearestFeature != null)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain84") + lastDistance + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain85") + nearestFeature.OID);

                                                                            for (int i = 0; i < sourceFieldNums.Length; i++)
                                                                            {
                                                                                try
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain86") + sourceFieldNames[i] + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain87") + destFieldNames[i]);

                                                                                    inObject.set_Value(destFieldNums[i], nearestFeature.get_Value(sourceFieldNums[i]));
                                                                                }
                                                                                catch
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14n") + sourceFieldNames[i] + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain87") + destFieldNames[i]);

                                                                                }
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain88"));

                                                                            for (int i = 0; i < destFieldNums.Length; i++)
                                                                            {
                                                                                IField field = inObject.Fields.get_Field(destFieldNums[i]);
                                                                                object newval = field.DefaultValue;
                                                                                if (newval == null)
                                                                                {
                                                                                    if (field.IsNullable)
                                                                                    {
                                                                                        inObject.set_Value(destFieldNums[i], null);
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    inObject.set_Value(destFieldNums[i], newval);
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14o") + missingFieldMess);
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + sourceLayerName + " data source is not set");
                                                                }
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + sourceLayerName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                            }
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14e") + valData);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14f"));
                                                    }
                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "NEAREST_FEATURE_ATTRIBUTES" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "NEAREST_FEATURE_ATTRIBUTES");
                                                }
                                                break;
                                            }
                                        case "MINIMUM_LENGTH":
                                            {
                                                try
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "MINIMUM_LENGTH");

                                                    double minlength;
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain89"));

                                                    if (Double.TryParse(valData, out minlength))
                                                    {
                                                        if (inFeature != null)
                                                        {
                                                            ICurve curve = inFeature.Shape as ICurve;
                                                            if (curve != null)
                                                            {
                                                                if (curve.Length < minlength)
                                                                {
                                                                    String mess = "Line is shorter than " +
                                                                        String.Format("{0:0.00}", minlength) + " " + Globals.GetSpatRefUnitName(inFeature.Shape.SpatialReference, true) +
                                                                        ", aborting edit.";
                                                                    AAState.WriteLine("                  " + mess);

                                                                    MessageBox.Show(mess, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain90"));
                                                                    AAState._editor.AbortOperation();
                                                                    return false;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14p"));

                                                            }
                                                        }
                                                    }
                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "MINIMUM_LENGTH \n" + ex.Message);
                                                }
                                                finally
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "MINIMUM_LENGTH");

                                                }

                                                break;
                                            }
                                        case "LINK_TABLE_ASSET":

                                            try
                                            {
                                                intersectLayerName = "";
                                                intersectTable = null;
                                                intersectLayer = null;
                                                List<string> intersectLayerFieldNameList = new List<string>();
                                                List<int> intersectFieldPosList = new List<int>();
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "LINK_TABLE_ASSET");
                                                args = valData.Split('|');
                                                switch (args.GetLength(0))
                                                {
                                                    case 1:  // Feature Layer only
                                                        intersectLayerName = args[0].ToString();
                                                        break;
                                                    case 2:  // Feature Layer| Field to copy
                                                        intersectLayerName = args[0].ToString();

                                                        intersectLayerFieldNameList = new List<string>(args[1].ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));

                                                        break;
                                                    case 3:  // Feature Layer| Field to copy | for future
                                                        intersectLayerName = args[0].ToString();
                                                        intersectLayerFieldNameList = new List<string>(args[1].ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));

                                                        break;
                                                    default:
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14q") + valData);
                                                        continue;

                                                }
                                                bool FCorLayerIntersect = true;
                                                intersectLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, intersectLayerName, ref FCorLayerIntersect);
                                                intersectTable = Globals.FindStandAloneTable(AAState._editor.Map, intersectLayerName);

                                                if (intersectLayer != null)
                                                {
                                                    //Find Area Field

                                                    foreach (string intersectLayerFieldName in intersectLayerFieldNameList)
                                                    {

                                                        intersectFieldPos = intersectLayer.FeatureClass.Fields.FindField(intersectLayerFieldName);
                                                        if (intersectFieldPos < 0)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14r") +"(" + intersectLayerFieldName + ") not found");
                                                            break;
                                                        }

                                                        else
                                                        {
                                                            intersectFieldPosList.Add(intersectFieldPos);
                                                        }
                                                    }
                                                    intersectLayerSelection = (IFeatureSelection)intersectLayer;
                                                    if (intersectLayerSelection.SelectionSet.Count == 0)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14s") + intersectLayerName);

                                                        break;
                                                    }
                                                    if (intersectLayerSelection.SelectionSet.Count > 1)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14t") + intersectLayerName);

                                                        break;
                                                    }

                                                    intersectLayerSelection.SelectionSet.Search(null, true, out cCurs);
                                                }
                                                else if (intersectTable != null)
                                                {
                                                    if (intersectTable.Table == null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14u") + "(" + intersectLayerName + ") not found");
                                                        break;
                                                    }

                                                    foreach (string intersectLayerFieldName in intersectLayerFieldNameList)
                                                    {

                                                        intersectFieldPos = intersectTable.Table.Fields.FindField(intersectLayerFieldName);
                                                        if (intersectFieldPos < 0)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14v") + "(" + intersectLayerFieldName + ") not found");
                                                            break;
                                                        }
                                                        else
                                                        {
                                                            intersectFieldPosList.Add(intersectFieldPos);
                                                        }
                                                    }

                                                    intersectTableSelection = (ITableSelection)intersectTable;
                                                    if (intersectTableSelection.SelectionSet.Count == 0)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14s") + intersectLayerName);

                                                        break;
                                                    }
                                                    if (intersectTableSelection.SelectionSet.Count > 1)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14t") + intersectLayerName);

                                                        break;
                                                    }

                                                    intersectTableSelection.SelectionSet.Search(null, true, out cCurs);
                                                }
                                                else
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14u") + "(" + intersectLayerName + ") not found");
                                                    break;
                                                }

                                                IRow row;

                                                while ((row = cCurs.NextRow()) != null)
                                                {
                                                    int idx = 0;
                                                    foreach (int fldIdxInt in intersectFieldPosList)
                                                    {
                                                        if (idx >= intFldIdxs.Count)
                                                            continue;

                                                        string val = row.get_Value(fldIdxInt).ToString();
                                                        if (inObject.Fields.get_Field(intFldIdxs[idx]).Type == esriFieldType.esriFieldTypeString)
                                                            inObject.set_Value(intFldIdxs[idx], val);
                                                        else if (inObject.Fields.get_Field(intFldIdxs[idx]).Type == esriFieldType.esriFieldTypeSmallInteger || inObject.Fields.get_Field(intFldIdxs[idx]).Type == esriFieldType.esriFieldTypeInteger)
                                                        {
                                                            if (Globals.IsNumeric(val))
                                                            {
                                                                inObject.set_Value(intFldIdxs[idx], Convert.ToInt32(val));

                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14w") + val);

                                                            }
                                                        }
                                                        else if (inObject.Fields.get_Field(intFldIdxs[idx]).Type == esriFieldType.esriFieldTypeSingle || inObject.Fields.get_Field(intFldIdxs[idx]).Type == esriFieldType.esriFieldTypeDouble)
                                                        {
                                                            if (Globals.IsNumeric(val))
                                                            {
                                                                inObject.set_Value(intFldIdxs[idx], Convert.ToDouble(val));

                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14x") + val);

                                                            }
                                                        }
                                                        else
                                                        {
                                                            inObject.set_Value(intFldIdxs[idx], val);
                                                        }
                                                        idx++;

                                                    }

                                                }
                                                if (row != null)
                                                    Marshal.ReleaseComObject(cCurs);

                                                row = null;

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "LINK_TABLE_ASSET" + Environment.NewLine + ex.Message);
                                            }

                                            finally
                                            {
                                                if (cCurs != null)
                                                {
                                                    Marshal.ReleaseComObject(cCurs);
                                                    GC.Collect(300);
                                                    GC.WaitForFullGCComplete();
                                                    cCurs = null;

                                                }
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "LINK_TABLE_ASSET");
                                            }
                                            break;

                                        case "GET_ADDRESS_FROM_CENTERLINE":

                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "GET_ADDRESS_FROM_CENTERLINE");
                                            List<IPoint> pPnts = null;
                                            try
                                            {
                                                if ((valData != null) && (inFeature != null))
                                                {
                                                    sourceLayerName = "";
                                                    string[] sourceFieldNames = null;

                                                    searchDistance = 0;

                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    if (args.Length == 2)
                                                    {
                                                        sourceLayerName = args[0].ToString().Trim();
                                                        sourceFieldNames = args[1].ToString().Split(',');
                                                        searchDistance = 2;
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain79"));

                                                    }
                                                    else if (args.Length == 3)
                                                    {
                                                        sourceLayerName = args[0].ToString().Trim();
                                                        sourceFieldNames = args[1].ToString().Split(',');
                                                        Double.TryParse(args[2], out searchDistance);

                                                    }

                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14d"));
                                                        continue;

                                                    }

                                                    if (sourceFieldNames.Length != 5)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14y"));
                                                        continue;

                                                    }

                                                    boolLayerOrFC = false;
                                                    if (sourceLayerName.Contains("("))
                                                    {
                                                        string[] tempSplt = sourceLayerName.Split('(');
                                                        sourceLayerName = tempSplt[0];
                                                        if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                        {
                                                            boolLayerOrFC = true;
                                                        }
                                                        else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                        {
                                                            boolLayerOrFC = true;
                                                        }
                                                        else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                        {
                                                            boolLayerOrFC = false;
                                                        }
                                                        else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                        {
                                                            boolLayerOrFC = false;
                                                        }
                                                        else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                        {
                                                            boolLayerOrFC = false;
                                                        }
                                                        else
                                                        {
                                                            boolLayerOrFC = true;
                                                        }
                                                    }
                                                    pPnts = Globals.GetGeomCenter(inObject as IFeature);
                                                    if (pPnts.Count != 0)
                                                    {

                                                        AddressInfo pRetValu = Globals.GetAddressInfo(ArcMap.Application, pPnts[0] as IPoint, sourceLayerName,
                                                            sourceFieldNames[0].Trim(), sourceFieldNames[1].Trim(), sourceFieldNames[2].Trim(), sourceFieldNames[3].Trim(), sourceFieldNames[4].Trim(), false, searchDistance);
                                                        if (pRetValu != null)
                                                        {
                                                            if (pRetValu.Messages == "")
                                                            {

                                                                bool rightSide = true;
                                                                IPoint pPnt = Globals.GetPointOnLine((inObject as IFeature).Shape as IPoint, pRetValu.StreetGeometry as IPolyline, 400, out rightSide);

                                                                try
                                                                {
                                                                    if (strFldNames.Count == 2)
                                                                    {
                                                                        if (intFldIdxs[0] != -1)
                                                                        {
                                                                            if (rightSide)
                                                                            {
                                                                                inObject.set_Value(intFldIdxs[0], pRetValu.RightAddress);
                                                                            }
                                                                            else
                                                                            {
                                                                                inObject.set_Value(intFldIdxs[0], pRetValu.LeftAddress);
                                                                            }
                                                                        }
                                                                        if (intFldIdxs[1] != -1)
                                                                            inObject.set_Value(intFldIdxs[1], pRetValu.StreetName);

                                                                    }
                                                                    else
                                                                    {
                                                                        if (intFldIdxs[0] != -1)
                                                                        {
                                                                            if (rightSide)
                                                                            {
                                                                                inObject.set_Value(intFldIdxs[0], pRetValu.RightAddress + " " + pRetValu.StreetName);
                                                                            }
                                                                            else
                                                                            {
                                                                                inObject.set_Value(intFldIdxs[0], pRetValu.LeftAddress + " " + pRetValu.StreetName);
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                                catch (Exception ex)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14z") + Environment.NewLine + ex.Message);
                                                                }
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aa") + pRetValu.Messages);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ab"));
                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ac"));
                                                    }

                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "GET_ADDRESS_FROM_CENTERLINE" + Environment.NewLine + ex.Message);
                                            }

                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "GET_ADDRESS_FROM_CENTERLINE");
                                                pPnts = null;

                                            }

                                            break;

                                        case "GET_ADDRESS_USING_GEOCODER":
                                            {
                                                IReverseGeocoding reverseGeocoding = null;
                                                IAddressGeocoding addressGeocoding = null;
                                                IPoint revGCLoc = null;
                                                IFields matchFields = null;
                                                IField shapeField = null;

                                                IReverseGeocodingProperties reverseGeocodingProperties = null;
                                                IPropertySet addressProperties = null;

                                                IAddressInputs addressInputs = null;
                                                IFields addressFields = null;
                                                object key = null;
                                                object value = null;
                                                try
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "GET_ADDRESS_USING_GEOCODER");

                                                    if (!String.IsNullOrEmpty(valData))
                                                    {
                                                        args = valData.Split('|');
                                                        if (args.Length != 2)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ad"));
                                                            break;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ad"));
                                                        break;
                                                    }
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain91"));
                                                    reverseGeocoding = Globals.OpenLocator(args[0], args[1]);

                                                    if (reverseGeocoding == null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ae"));
                                                        break;
                                                    }
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain92"));
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain93"));
                                                    revGCLoc = Globals.GetGeomCenter(inFeature)[0];
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain94"));
                                                    // Create a Point at which to find the address.
                                                    addressGeocoding = (IAddressGeocoding)reverseGeocoding;

                                                    matchFields = addressGeocoding.MatchFields;
                                                    int shpFld = matchFields.FindField("Shape");

                                                    shapeField = matchFields.get_Field(shpFld);
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain95"));
                                                    // Set the search tolerance for reverse geocoding.
                                                    reverseGeocodingProperties = (IReverseGeocodingProperties)reverseGeocoding;
                                                    reverseGeocodingProperties.SearchDistance = 100;
                                                    reverseGeocodingProperties.SearchDistanceUnits = esriUnits.esriFeet;
                                                    reverseGeocoding.InitDefaults();

                                                    // Find the address nearest the Point.
                                                    addressProperties = reverseGeocoding.ReverseGeocode(revGCLoc, false);

                                                    // Print the address properties.
                                                    addressInputs = (IAddressInputs)reverseGeocoding;
                                                    addressFields = addressInputs.AddressFields;

                                                    addressProperties.GetAllProperties(out key, out value);

                                                    string tempVal = "";
                                                    for (int i = 0; i < addressFields.FieldCount; i++)
                                                    {
                                                        IField addressField = addressFields.get_Field(i);
                                                        if (tempVal == "")
                                                        {
                                                            tempVal = addressProperties.GetProperty(addressField.Name).ToString();
                                                        }
                                                        else
                                                        {
                                                            tempVal = tempVal + ", " + addressProperties.GetProperty(addressField.Name).ToString();
                                                        }

                                                    }
                                                    inFeature.set_Value(intFldIdxs[0], tempVal);

                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "GET_ADDRESS_USING_GEOCODER" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "GET_ADDRESS_USING_GEOCODER");
                                                    reverseGeocoding = null;
                                                    addressGeocoding = null;
                                                    revGCLoc = null;
                                                    matchFields = null;
                                                    shapeField = null;

                                                    reverseGeocodingProperties = null;
                                                    addressProperties = null;

                                                    addressInputs = null;
                                                    addressFields = null;
                                                    key = null;
                                                    value = null;
                                                }
                                                break;

                                            }

                                        case "GET_ADDRESS_USING_ARCGIS_SERVICE":  //ARGS: url

                                            try
                                            {
                                                IPoint revGCLoc = null;
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "GET_ADDRESS_USING_ARCGIS_SERVICE");
                                                if (fieldObj.Type == esriFieldType.esriFieldTypeString)
                                                {
                                                    if ((inFeature != null) && (inFeature.Shape != null) && !(inFeature.Shape.IsEmpty))
                                                    {
                                                        args = valData.Split('|');
                                                        revGCLoc = Globals.GetGeomCenter(inFeature)[0];
                                                        int wkid = inFeature.Shape.SpatialReference.FactoryCode;
                                                        if (revGCLoc != null)
                                                        {
                                                            //Test for user specified URL
                                                            if (valData.Trim() != "")
                                                            {
                                                                if (args.Length == 2)
                                                                {
                                                                    wkid = Convert.ToInt32(args[1]);
                                                                }
                                                                if (Globals.IsUrl(args[0]))
                                                                {
                                                                    locatorURL = args[0];

                                                                    if (!(locatorURL.EndsWith(reverseGeocodeStr)))
                                                                    {
                                                                        if (!(locatorURL.EndsWith(GeocodeStr)))
                                                                        {
                                                                            if (!(locatorURL.EndsWith("/")))
                                                                            {
                                                                                locatorURL += "/" + GeocodeStr + "/" + reverseGeocodeStr;
                                                                            }
                                                                            else
                                                                            {
                                                                                locatorURL += GeocodeStr + "/" + reverseGeocodeStr;
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            if (!(locatorURL.EndsWith("/")))
                                                                            {
                                                                                locatorURL += "/" + reverseGeocodeStr;
                                                                            }
                                                                            else
                                                                            {
                                                                                locatorURL += reverseGeocodeStr;
                                                                            }
                                                                        }
                                                                    }
                                                                }

                                                                //else if (args[0] == "TA_Streets_US_10")
                                                                //{
                                                                //    locatorURL = _agsOnlineLocators + args[0] + GeocodeStr + "/" + reverseGeocodeStr;
                                                                //    //       wkid = 102100;
                                                                //}
                                                                //else if (args[0] == "TA_Address_NA_10" || args[0] == "TA_Address_EU")
                                                                //{
                                                                //    locatorURL = _agsOnlineLocators + args[0] + GeocodeStr + "/" + reverseGeocodeStr;
                                                                //    //    wkid = 4326;
                                                                //}
                                                                ////Default to AGS Online USA geocode service
                                                                //else if (_agsOnlineLocators.Substring(_agsOnlineLocators.LastIndexOf('/', _agsOnlineLocators.Length - 2)).Contains("Locator"))
                                                                //{
                                                                //    locatorURL = _agsOnlineLocators + "TA_Address_NA_10" + GeocodeStr + "/" + reverseGeocodeStr;
                                                                //    //        wkid = 4326;
                                                                //}
                                                                else
                                                                {
                                                                    locatorURL = _agsOnlineLocators + GeocodeStr + "/" + reverseGeocodeStr; ;
                                                                    //     wkid = 4326;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if (_agsOnlineLocators.Substring(_agsOnlineLocators.LastIndexOf('/', _agsOnlineLocators.Length - 2)).Contains(GeocodeStr))
                                                                {
                                                                    locatorURL = _agsOnlineLocators + "/" + reverseGeocodeStr;
                                                                    //      wkid = 4326;
                                                                }
                                                                else
                                                                {
                                                                    _agsOnlineLocators = _agsOnlineLocators + "/" + GeocodeStr;
                                                                    locatorURL = _agsOnlineLocators + "/" + reverseGeocodeStr;
                                                                    // wkid = 4326;
                                                                }
                                                            }

                                                            if (!locatorURL.ToUpper().Contains("/REST/"))
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14af"));
                                                            }
                                                            else
                                                            {
                                                                //Copy point from this current feature
                                                                _copyPoint = revGCLoc;//inFeature.ShapeCopy as IPoint;

                                                                StreamReader reader = null;
                                                                HttpWebRequest request = null;
                                                                try
                                                                {
                                                                    // Create the web request
                                                                    request = WebRequest.Create(_agsOnlineLocators) as HttpWebRequest;

                                                                    // Get response

                                                                    using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                                                                    {
                                                                        // Get the response stream
                                                                        reader = new StreamReader(response.GetResponseStream());
                                                                        string resp = reader.ReadToEnd();
                                                                        resp = resp.Substring(resp.IndexOf("Spatial Reference:"));
                                                                        resp = resp.Substring(0, resp.IndexOf("<br/>"));
                                                                        resp = resp.Substring(resp.IndexOf("</b>") + 4);
                                                                        wkid = Convert.ToInt32(resp.Split(' ')[0]);

                                                                    }
                                                                }
                                                                catch (Exception ex)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain96"));
                                                                    wkid = 4326;
                                                                }
                                                                finally
                                                                {

                                                                    reader = null;
                                                                    request = null;
                                                                }

                                                                _copyPoint.Project(Globals.CreateSpatRef(wkid));
                                                                //Include location parameters in URL
                                                                string results = Globals.FormatLocationRequest(locatorURL, _copyPoint.X, _copyPoint.Y, 100);
                                                                //Send and receieve the request
                                                                WebRequest req = null;
                                                                WebResponse res = null;

                                                                XmlDictionaryReader xr = null;
                                                                XmlDocument doc = null;
                                                                try
                                                                {
                                                                    req = WebRequest.Create(results);
                                                                    res = req.GetResponse();

                                                                    //Convert response from JSON to XML
                                                                    doc = new XmlDocument();
                                                                    using (Stream s = res.GetResponseStream())
                                                                    {
                                                                        xr = JsonReaderWriterFactory.CreateJsonReader(s, XmlDictionaryReaderQuotas.Max);
                                                                        doc.Load(xr);
                                                                        xr.Close();
                                                                        s.Close();
                                                                        string val = "";

                                                                        for (int h = 0; h < doc.DocumentElement.FirstChild.ChildNodes.Count - 1; h++)
                                                                        {
                                                                            if (doc.DocumentElement.FirstChild.ChildNodes[h].Name.Contains("Match") == false)
                                                                            {
                                                                                if (val == "")
                                                                                {
                                                                                    val = doc.DocumentElement.FirstChild.ChildNodes[h].InnerText;
                                                                                }
                                                                                else
                                                                                {
                                                                                    if (val.EndsWith(","))
                                                                                        val = val + " " + doc.DocumentElement.FirstChild.ChildNodes[h].InnerText;
                                                                                    else
                                                                                        val = val + ", " + doc.DocumentElement.FirstChild.ChildNodes[h].InnerText;

                                                                                }
                                                                            }

                                                                            val = val.Trim();
                                                                        }

                                                                        inFeature.set_Value(intFldIdxs[0], val);

                                                                    }
                                                                }
                                                                catch
                                                                {
                                                                }
                                                                finally
                                                                {
                                                                    req = null;
                                                                    res = null;

                                                                    xr = null;
                                                                    doc = null;
                                                                }

                                                            }
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain97"));
                                                        }
                                                    }

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "GET_ADDRESS_USING_ARCGIS_SERVICE: " + ex.Message);
                                            }

                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "GET_ADDRESS_USING_ARCGIS_SERVICE");
                                            }
                                            break;
                                        case "TIMESTAMP":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "TIMESTAMP");

                                                if (!String.IsNullOrEmpty(valData))
                                                {
                                                    args = valData.Split('|');
                                                    if (args.Length > 0)
                                                    {

                                                        try
                                                        {

                                                            if (fieldObj.Type == esriFieldType.esriFieldTypeDate)
                                                            {
                                                                if (args[0].ToString().ToUpper() == "DATE")
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], DateTime.Now.Date);
                                                                }
                                                                else if (args[0].ToString().Trim() != "")
                                                                {
                                                                    try
                                                                    {
                                                                        inObject.set_Value(intFldIdxs[0], DateTime.Now.ToString(args[0]));
                                                                    }
                                                                    catch
                                                                    {
                                                                        inObject.set_Value(intFldIdxs[0], DateTime.Now.ToString());
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], DateTime.Now);
                                                                }
                                                            }
                                                            else if (fieldObj.Type == esriFieldType.esriFieldTypeString)
                                                            {
                                                                if (args[0].ToString().ToUpper() == "DATE")
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], DateTime.Now.Date);
                                                                }
                                                                else if (args[0].ToString().ToUpper() == "TIME")
                                                                {

                                                                    inObject.set_Value(intFldIdxs[0], DateTime.Now.ToString("hh:mm:ss tt"));
                                                                }
                                                                else if (args[0].ToString().ToUpper() == "TIME24")
                                                                {
                                                                    //  ReadOnlyCollection<System.TimeZoneInfo> timeZones = System.TimeZoneInfo.GetSystemTimeZones();
                                                                    //  string s = System.TimeZoneInfo.ConvertTime(DateTime.Now, timeZones[0]).ToString("HH:mm:ss");

                                                                    inObject.set_Value(intFldIdxs[0], DateTime.Now.ToString("HH:mm:ss"));
                                                                }
                                                                else if (args[0].ToString().ToUpper() == "YEAR")
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], DateTime.Now.Year.ToString());
                                                                }
                                                                else if (args[0].ToString().ToUpper() == "MONTH")
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], DateTime.Now.Month.ToString());
                                                                }
                                                                else if (args[0].ToString().ToUpper() == "DAY")
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], DateTime.Now.DayOfWeek.ToString());
                                                                }
                                                                else if (args[0].ToString().Trim() != "")
                                                                {
                                                                    try
                                                                    {
                                                                        inObject.set_Value(intFldIdxs[0], DateTime.Now.ToString(args[0]));
                                                                    }
                                                                    catch
                                                                    {
                                                                        inObject.set_Value(intFldIdxs[0], DateTime.Now.ToString());
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], DateTime.Now.ToString());
                                                                }
                                                            }

                                                        }
                                                        catch
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ag"));
                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain98"));
                                                        if (fieldObj.Type == esriFieldType.esriFieldTypeDate)
                                                            inObject.set_Value(intFldIdxs[0], DateTime.Now);
                                                        else if (fieldObj.Type == esriFieldType.esriFieldTypeString)
                                                            inObject.set_Value(intFldIdxs[0], DateTime.Now.ToString());

                                                    }
                                                }
                                                else
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain98"));
                                                    if (fieldObj.Type == esriFieldType.esriFieldTypeDate)
                                                        inObject.set_Value(intFldIdxs[0], DateTime.Now);
                                                    else if (fieldObj.Type == esriFieldType.esriFieldTypeString)
                                                        inObject.set_Value(intFldIdxs[0], DateTime.Now.ToString());

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TIMESTAMP: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TIMESTAMP");
                                            }
                                            break;

                                        case "LAST_VALUE":
                                            try
                                            {

                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "LAST_VALUE");
                                                bool CheckForValue = false;
                                                if (!String.IsNullOrEmpty(valData))
                                                {
                                                    args = valData.Split('|');
                                                    if (args.Length > 0)
                                                    {
                                                        if (args[0].ToString().ToUpper() == "TRUE")
                                                        {
                                                            CheckForValue = true;
                                                        }
                                                    }

                                                }
                                                else
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain98"));
                                                }
                                                if (CheckForValue && (inObject.get_Value(intFldIdxs[0]) != null && inObject.get_Value(intFldIdxs[0]) != DBNull.Value))
                                                {

                                                }
                                                else
                                                {
                                                    if (mode == "ON_CREATE")
                                                    {

                                                        lastValue = AAState.lastValueProperties.GetProperty(strFldNames[0]) as LastValueEntry;
                                                        if (lastValue == null)
                                                        {
                                                            if (inObject.get_Value(intFldIdxs[0]) != null)
                                                            {
                                                                if (inObject.get_Value(intFldIdxs[0]) != DBNull.Value)
                                                                {
                                                                    AAState.lastValueProperties.SetProperty(strFldNames[0], inObject.get_Value(intFldIdxs[0]));
                                                                }
                                                            }
                                                        }
                                                        else if (lastValue.Value != null)
                                                        {
                                                            if (lastValue.Value != DBNull.Value)
                                                            {
                                                                inObject.set_Value(intFldIdxs[0], lastValue.Value);

                                                                AAState.WriteLine("                  " + strFldNames[0] + ": " + lastValue.Value);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (inObject.get_Value(intFldIdxs[0]) != null)
                                                            {
                                                                if (inObject.get_Value(intFldIdxs[0]) != DBNull.Value)
                                                                {
                                                                    AAState.lastValueProperties.SetProperty(strFldNames[0], inObject.get_Value(intFldIdxs[0]));
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else if (mode == "ON_CHANGE")
                                                    {
                                                        IRowChanges pRowCh = inObject as IRowChanges;
                                                        changed = pRowCh.get_ValueChanged(intFldIdxs[0]);
                                                        if (!changed)
                                                        {
                                                            lastValue = AAState.lastValueProperties.GetProperty(strFldNames[0]) as LastValueEntry;
                                                            if (lastValue != null)
                                                            {
                                                                if (lastValue.Value != null)
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], lastValue.Value);
                                                                    AAState.WriteLine("                  " + strFldNames[0] + ": " + lastValue.Value);
                                                                }

                                                            }
                                                        }
                                                    }

                                                }
                                            }
                                            catch (Exception ex)
                                            {

                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "LAST_VALUE: " + ex.Message);

                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "LAST_VALUE");
                                            }
                                            break;

                                        case "X_COORDINATE":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "X_COORDINATE");
                                                if ((inFeature != null) && (inFeature.Shape != null) && !(inFeature.Shape.IsEmpty))
                                                {
                                                    if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPoint)
                                                    {
                                                        _copyPoint = inFeature.Shape as IPoint;
                                                        inFeature.set_Value(intFldIdxs[0], _copyPoint.X);
                                                    }
                                                    else if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline)
                                                    {
                                                        _copyPolyline = inFeature.Shape as IPolyline;
                                                        if (valData.Trim() == "")
                                                        {
                                                            inFeature.set_Value(intFldIdxs[0], Globals.GetGeomCenter(_copyPolyline)[0].X);
                                                        }
                                                        else
                                                        {
                                                            args = valData.Split('|');
                                                            if (args[0].ToUpper() == "S")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], _copyPolyline.FromPoint.X);
                                                            }
                                                            else if (args[0].ToUpper() == "E")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], _copyPolyline.ToPoint.X);
                                                            }
                                                            else
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.GetGeomCenter(_copyPolyline)[0].X);
                                                            }

                                                        }

                                                    }
                                                    else if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon)
                                                    {

                                                        _copyPolygon = inFeature.ShapeCopy as IPolygon;
                                                        if (valData.Trim() == "")
                                                        {
                                                            inFeature.set_Value(intFldIdxs[0], Globals.GetGeomCenter(_copyPolygon)[0].X);
                                                        }
                                                        else
                                                        {
                                                            args = valData.Split('|');
                                                            if (args[0].ToUpper() == "S")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], _copyPolygon.FromPoint.X);
                                                            }
                                                            else if (args[0].ToUpper() == "E")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], _copyPolygon.ToPoint.X);
                                                            }
                                                            else
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.GetGeomCenter(_copyPolygon)[0].X);
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ah"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "X_COORDINATE: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "X_COORDINATE");
                                            }
                                            break;

                                        case "Y_COORDINATE":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "Y_COORDINATE");
                                                if ((inFeature != null) && (inFeature.Shape != null) && !(inFeature.Shape.IsEmpty))
                                                {
                                                    if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPoint)
                                                    {
                                                        _copyPoint = inFeature.Shape as IPoint;
                                                        inFeature.set_Value(intFldIdxs[0], _copyPoint.Y);
                                                    }
                                                    else if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline)
                                                    {
                                                        _copyPolyline = inFeature.Shape as IPolyline;
                                                        if (valData == "")
                                                        {
                                                            inFeature.set_Value(intFldIdxs[0], Globals.GetGeomCenter(_copyPolyline)[0].Y);
                                                        }
                                                        else
                                                        {
                                                            args = valData.Split('|');
                                                            if (args[0].ToUpper() == "S")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], _copyPolyline.FromPoint.Y);
                                                            }
                                                            else if (args[0].ToUpper() == "E")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], _copyPolyline.ToPoint.Y);
                                                            }
                                                            else
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.GetGeomCenter(_copyPolyline)[0].Y);
                                                            }

                                                        }

                                                    }
                                                    else if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon)
                                                    {
                                                        _copyPolygon = inFeature.ShapeCopy as IPolygon;

                                                        if (valData.Trim() == "")
                                                        {
                                                            inFeature.set_Value(intFldIdxs[0], Globals.GetGeomCenter(_copyPolygon)[0].Y);
                                                        }
                                                        else
                                                        {
                                                            args = valData.Split('|');
                                                            if (args[0].ToUpper() == "S")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], _copyPolygon.FromPoint.Y);
                                                            }
                                                            else if (args[0].ToUpper() == "E")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], _copyPolygon.ToPoint.Y);
                                                            }
                                                            else
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.GetGeomCenter(_copyPolygon)[0].Y);
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ah"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "Y_COORDINATE: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "Y_COORDINATE");
                                            }
                                            break;

                                        case "LATITUDE":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "LATITUDE");
                                                if ((inFeature != null) && (inFeature.Shape != null) && !(inFeature.Shape.IsEmpty))
                                                {

                                                    if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPoint)
                                                    {
                                                        _copyPoint = inFeature.ShapeCopy as IPoint;
                                                        _copyPoint.Project(AAState._sr1);
                                                        inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), _copyPoint.Y.ToString()));

                                                    }
                                                    else if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline)
                                                    {
                                                        _copyPolyline = inFeature.ShapeCopy as IPolyline;
                                                        _copyPolyline.Project(AAState._sr1);

                                                        if (valData == "")
                                                        {
                                                            inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), Globals.GetGeomCenter(_copyPolyline)[0].Y.ToString()));

                                                        }
                                                        else
                                                        {
                                                            args = valData.Split('|');
                                                            if (args[0].ToUpper() == "S")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), _copyPolyline.FromPoint.Y.ToString()));

                                                            }
                                                            else if (args[0].ToUpper() == "E")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), _copyPolyline.ToPoint.Y.ToString()));

                                                            }
                                                            else
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), Globals.GetGeomCenter(_copyPolyline)[0].Y.ToString()));

                                                            }

                                                        }

                                                    }
                                                    else if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon)
                                                    {
                                                        _copyPolygon = inFeature.ShapeCopy as IPolygon;
                                                        _copyPolygon.Project(AAState._sr1);

                                                        if (valData.Trim() == "")
                                                        {
                                                            inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), Globals.GetGeomCenter(_copyPolygon)[0].Y.ToString()));

                                                        }
                                                        else
                                                        {
                                                            args = valData.Split('|');
                                                            if (args[0].ToUpper() == "S")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), _copyPolygon.FromPoint.Y.ToString()));

                                                            }
                                                            else if (args[0].ToUpper() == "E")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), _copyPolygon.ToPoint.Y.ToString()));

                                                            }
                                                            else
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), Globals.GetGeomCenter(_copyPolygon)[0].Y.ToString()));

                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ah"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "LATITUDE: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "LATITUDE");
                                            }
                                            break;

                                        case "LONGITUDE":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "LONGITUDE");
                                                if ((inFeature != null) && (inFeature.Shape != null) && !(inFeature.Shape.IsEmpty))
                                                {

                                                    if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPoint)
                                                    {
                                                        _copyPoint = inFeature.ShapeCopy as IPoint;
                                                        _copyPoint.Project(AAState._sr1);

                                                        inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), _copyPoint.X.ToString()));

                                                    }
                                                    else if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline)
                                                    {
                                                        _copyPolyline = inFeature.Shape as IPolyline;
                                                        _copyPolyline.Project(AAState._sr1);

                                                        if (valData == "")
                                                        {

                                                            inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), Globals.GetGeomCenter(_copyPolyline)[0].X.ToString()));

                                                        }
                                                        else
                                                        {
                                                            args = valData.Split('|');
                                                            if (args[0].ToUpper() == "S")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), _copyPolyline.FromPoint.X.ToString()));

                                                            }
                                                            else if (args[0].ToUpper() == "E")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), _copyPolyline.ToPoint.X.ToString()));

                                                            }
                                                            else
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), Globals.GetGeomCenter(_copyPolyline)[0].X.ToString()));

                                                            }

                                                        }

                                                    }
                                                    else if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon)
                                                    {
                                                        _copyPolygon = inFeature.ShapeCopy as IPolygon;
                                                        _copyPolygon.Project(AAState._sr1);

                                                        if (valData.Trim() == "")
                                                        {
                                                            inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), Globals.GetGeomCenter(_copyPolygon)[0].X.ToString()));

                                                        }
                                                        else
                                                        {
                                                            args = valData.Split('|');
                                                            if (args[0].ToUpper() == "S")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), _copyPolygon.FromPoint.X.ToString()));

                                                            }
                                                            else if (args[0].ToUpper() == "E")
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), _copyPolygon.ToPoint.X.ToString()));

                                                            }
                                                            else
                                                            {
                                                                inFeature.set_Value(intFldIdxs[0], Globals.FormatValueToFieldLength(inFeature.Fields.get_Field(intFldIdxs[0]), Globals.GetGeomCenter(_copyPolygon)[0].X.ToString()));

                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ah"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "LONGITUDE: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "LONGITUDE");
                                            }
                                            break;

                                        case "FIELD":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "Field");
                                                // verify that field to copy exists

                                                if (!String.IsNullOrEmpty(valData))
                                                {
                                                    args = valData.Split('|');
                                                    fieldCopy = inObject.Fields.FindField(args[0] as string);

                                                    if (fieldCopy > -1)
                                                    {
                                                        bool useDisplayValue = true;
                                                        if (args.Length == 2)
                                                        {
                                                            if (args[1].ToUpper() == "CODE")
                                                                useDisplayValue = false;
                                                        }

                                                        try
                                                        {
                                                            if (useDisplayValue)
                                                            {

                                                                inObject.set_Value(intFldIdxs[0], Globals.GetDomainDisplay(inObject.get_Value(fieldCopy), inObject as IFeature, inObject.Fields.get_Field(fieldCopy)));
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));
                                                            }

                                                            else
                                                            {
                                                                inObject.set_Value(intFldIdxs[0], inObject.get_Value(fieldCopy));
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));
                                                            }
                                                        }
                                                        catch (Exception ex)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + ex.Message);
                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + valData + " is not found");
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "Field: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "Field");
                                            }
                                            break;

                                        //CURRENT_USER
                                        //Value Data options:
                                        //U - windows username only
                                        //W or (blank) - full username including domain i.e. domain\username
                                        //D - database user if available and not dbo
                                        case "CURRENT_USER":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "CURRENT_USER");

                                                lastEditorName = AAState._currentUserInfo.GetCurrentUser(valData, fieldObj.Length);
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain99") + lastEditorName);

                                                if (!String.IsNullOrEmpty(lastEditorName))
                                                {
                                                    inObject.set_Value(intFldIdxs[0], lastEditorName);
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "CURRENT_USER: "******"AttributeAssistantEditorMess_14as") + "CURRENT_USER");
                                            }
                                            break;

                                        case "JUNCTION_ROTATION":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "JUNCTION_ROTATION");
                                                if ((inFeature != null))
                                                {
                                                    AAState.rCalc.RotationType = esriSymbolRotationType.esriRotateSymbolGeographic;
                                                    args = null;
                                                    AAState.rCalc.UseDiameter = false;
                                                    AAState.rCalc.DiameterFieldName = "";
                                                    AAState.rCalc.SpinAngle = 0;

                                                    if (!String.IsNullOrEmpty(valData))
                                                    {
                                                        args = valData.Split('|');
                                                        if (args.Length == 0)
                                                        {

                                                            AAState.rCalc.RotationType = esriSymbolRotationType.esriRotateSymbolGeographic;
                                                        }
                                                        else if (args.Length == 1)
                                                        {
                                                            if (args[0].Substring(0, 1).ToLower() == "a")
                                                                AAState.rCalc.RotationType = esriSymbolRotationType.esriRotateSymbolArithmetic;

                                                        }
                                                        else if (args.Length == 2)
                                                        {
                                                            if (args[0].Substring(0, 1).ToLower() == "a")
                                                                AAState.rCalc.RotationType = esriSymbolRotationType.esriRotateSymbolArithmetic;
                                                            if (Globals.IsNumeric(args[1].ToString()))
                                                                AAState.rCalc.SpinAngle = Convert.ToDouble(args[1]);

                                                        }
                                                        else if (args.Length == 3)
                                                        {
                                                            if (args[0].Substring(0, 1).ToLower() == "a")
                                                                AAState.rCalc.RotationType = esriSymbolRotationType.esriRotateSymbolArithmetic;
                                                            if (Globals.IsNumeric(args[1].ToString()))
                                                                AAState.rCalc.SpinAngle = Convert.ToDouble(args[1]);
                                                            AAState.rCalc.UseDiameter = true;
                                                            AAState.rCalc.DiameterFieldName = args[2].ToString();

                                                        }
                                                        else
                                                        {
                                                            AAState.rCalc.RotationType = esriSymbolRotationType.esriRotateSymbolGeographic;
                                                        }

                                                    }
                                                    AAState.WriteLine("                  " + AAState.rCalc.RotationType.ToString() + " is being used");
                                                    rotationAngle = AAState.rCalc.GetRotationUsingConnectedEdges(inFeature);
                                                    if (rotationAngle == null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain100"));
                                                        continue;
                                                    }

                                                    //Accept optional second argument to provide extra rotation

                                                    if (rotationAngle != -1)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain101") + rotationAngle.ToString());

                                                        inObject.set_Value(intFldIdxs[0], rotationAngle);
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain102"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "JUNCTION_ROTATION \r\n" + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "JUNCTION_ROTATION");
                                            }
                                            break;

                                        //For Release: 1.2
                                        //New Dynamic Value Method: Length - stores calculated length of line feature
                                        case "LENGTH":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "LENGTH");
                                                if (inFeature != null)
                                                {
                                                    curve = (ICurve)inFeature.Shape;
                                                    if (curve != null)
                                                    {
                                                        inObject.set_Value(intFldIdxs[0], curve.Length);
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "LENGTH: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "LENGTH");
                                            }
                                            break;

                                        //Release: 1.2
                                        //New Dynamic Value Method: SET_MEASURES - stores calculated M values (from 0 to length of line) for line feature
                                        //Value Data options:
                                        //P = Percent - Ms will be zero to 100
                                        //default - Ms will be zero to length of line
                                        case "SET_MEASURES":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "SET_MEASURES");
                                                if (inFeature != null)
                                                {
                                                    curve = inFeature.Shape as ICurve;
                                                    mseg = inFeature.Shape as IMSegmentation;
                                                    if (curve != null && mseg != null)
                                                        if (valData != null && valData != "" && valData.Substring(0, 1).ToUpper() == "P")
                                                            mseg.SetAndInterpolateMsBetween(0, 100);
                                                        else
                                                            mseg.SetAndInterpolateMsBetween(0, curve.Length);
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "SET_MEASURES: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "SET_MEASURES");
                                            }
                                            break;
                                        //case "EDGE_INTERSECT_SECOND":
                                        //    try
                                        //    {
                                        //        if (inFeature != null)
                                        //        {
                                        //            netFeat = inFeature as INetworkFeature;
                                        //            if (netFeat != null)
                                        //            {
                                        //                if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                        //                {

                                        //                    iJuncFeat = (IJunctionFeature)netFeat;
                                        //                    // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                        //                    ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                        //                    if (iSJunc == null)
                                        //                        break;
                                        //                    if (iSJunc.EdgeFeatureCount <= 1)
                                        //                        break;
                                        //                    iEdgeFeat = iSJunc.get_EdgeFeature(1);

                                        //                    // verify that field (in junction) to copy exists

                                        //                    IRow pRow = iEdgeFeat as IRow;

                                        //                    juncField = pRow.Fields.FindField(valData as string);
                                        //                    if (juncField > -1)
                                        //                    {
                                        //                        inObject.set_Value(intFldIdxs[0], pRow.get_Value(juncField));
                                        //                    }
                                        //                }
                                        //            }
                                        //        }
                                        //    }
                                        //    catch
                                        //    {
                                        //    }
                                        //    break;
                                        //case "EDGE_INTERSECT_FIRST":
                                        //    try
                                        //    {
                                        //        if (inFeature != null)
                                        //        {
                                        //            netFeat = inFeature as INetworkFeature;
                                        //            if (netFeat != null)
                                        //            {
                                        //                if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                        //                {

                                        //                    iJuncFeat = (IJunctionFeature)netFeat;
                                        //                    // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                        //                    ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                        //                    if (iSJunc == null)
                                        //                        break;
                                        //                    if (iSJunc.EdgeFeatureCount <= 0)
                                        //                        break;
                                        //                    iEdgeFeat = iSJunc.get_EdgeFeature(0);

                                        //                    IRow pRow = iEdgeFeat as IRow;

                                        //                    juncField = pRow.Fields.FindField(valData as string);
                                        //                    if (juncField > -1)
                                        //                    {
                                        //                        inObject.set_Value(intFldIdxs[0], pRow.get_Value(juncField));
                                        //                    }
                                        //                }
                                        //            }
                                        //        }
                                        //    }
                                        //    catch
                                        //    {
                                        //    }
                                        //    break;

                                        //Release: 2.0
                                        //New Dynamic Value Method: TO_EDGE_FIELD transfers a field value from a connected egde feature to a junction feature
                                        //Takes value from the frist edge whose "TO" point connects with this junction
                                        case "TO_EDGE_FIELD":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "TO_EDGE_FIELD");
                                                if (inFeature != null)
                                                {
                                                    if (valData == null)
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ba"));
                                                        break;
                                                    }
                                                    netFeat = inFeature as INetworkFeature;
                                                    if (netFeat != null)
                                                    {
                                                        if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                                        {
                                                            string netField = "";
                                                            string netRestrictFC = "";
                                                            string netRestrictField = "";
                                                            string netRestrictValue = "";
                                                            args = valData.Split('|');
                                                            switch (args.GetLength(0))
                                                            {
                                                                case 1:  // sequenceColumnName only
                                                                    netField = args[0].ToString().Trim();
                                                                    break;
                                                                case 2:  // sequenceColumnName|sequenceFixedWidth
                                                                    netField = args[0].ToString().Trim();
                                                                    netRestrictFC = args[1].ToString().Trim();
                                                                    break;
                                                                case 3:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                    netField = args[0].ToString().Trim();
                                                                    netRestrictFC = args[1].ToString().Trim();
                                                                    netRestrictField = args[2].ToString().Trim();
                                                                    break;
                                                                case 4:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                    netField = args[0].ToString().Trim();
                                                                    netRestrictFC = args[1].ToString().Trim();
                                                                    netRestrictField = args[2].ToString().Trim();
                                                                    netRestrictValue = args[3].ToString().Trim();
                                                                    break;
                                                                default: break;
                                                            }

                                                            iJuncFeat = (IJunctionFeature)netFeat;
                                                            // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                                            ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                                            if (iSJunc == null)
                                                                break;
                                                            if (iSJunc.EdgeFeatureCount <= 0)
                                                                break;
                                                            if (iSJunc.EdgeFeatureCount > 0)
                                                            {
                                                                for (int i = 0; i < iSJunc.EdgeFeatureCount; i++)
                                                                {
                                                                    iEdgeFeat = iSJunc.get_EdgeFeature(i);
                                                                    try
                                                                    {

                                                                        if (netRestrictFC != "")
                                                                        {
                                                                            string strClsName = Globals.getClassName(((IDataset)((IFeature)iEdgeFeat).Class));

                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bf") + strClsName);
                                                                            if (strClsName != netRestrictFC)
                                                                            {
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bg"));
                                                                                continue;
                                                                            }
                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bh"));
                                                                            if (netRestrictField != "" && netRestrictValue != "")
                                                                            {
                                                                                int intTmpFld = Globals.GetFieldIndex(((IFeature)iEdgeFeat).Fields, netRestrictField);

                                                                                if (intTmpFld > -1)
                                                                                {
                                                                                    //IFeature pTest = ((IFeature)iEdgeFeat);

                                                                                    if (((IFeature)iEdgeFeat).get_Value(intTmpFld).ToString() == netRestrictValue)
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bl"));
                                                                                        continue;

                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine("                  " + netRestrictField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bm"));
                                                                            }
                                                                        }

                                                                        iJuncFeat = (IJunctionFeature)iEdgeFeat.FromJunctionFeature;
                                                                        if (((IFeature)iJuncFeat).Shape.Equals(inFeature.Shape))
                                                                        {
                                                                            IRow pRow = iEdgeFeat as IRow;

                                                                            // verify that field (in junction) to copy exists
                                                                            juncField = Globals.GetFieldIndex(pRow.Fields, netField);

                                                                            if (juncField > -1)
                                                                            {
                                                                                inObject.set_Value(intFldIdxs[0], pRow.get_Value(juncField));
                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine("                  " + netField + " field not found in edge");
                                                                            }
                                                                            pRow = null;
                                                                            break;

                                                                        }
                                                                    }
                                                                    catch
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14an"));
                                                                    }

                                                                }
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bi"));
                                                            }
                                                            iSJunc = null;
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bj"));
                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bk"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TO_EDGE_FIELD: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TO_EDGE_FIELD");
                                            }
                                            break;

                                        //Release: 2.0
                                        //New Dynamic Value Method: FROM_EDGE_FIELD transfers a field value from a connected egde feature to a junction feature
                                        //Takes value from the frist edge whose "FROM" point connects with this junction
                                        case "FROM_EDGE_FIELD":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "FROM_EDGE_FIELD");
                                                if (inFeature != null)
                                                {
                                                    if (valData == null)
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ba"));
                                                        break;
                                                    }
                                                    netFeat = inFeature as INetworkFeature;
                                                    if (netFeat != null)
                                                    {
                                                        if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                                        {
                                                            string netField = "";
                                                            string netRestrictFC = "";
                                                            string netRestrictField = "";
                                                            string netRestrictValue = "";
                                                            args = valData.Split('|');
                                                            switch (args.GetLength(0))
                                                            {
                                                                case 1:  // sequenceColumnName only
                                                                    netField = args[0].ToString().Trim();
                                                                    break;
                                                                case 2:  // sequenceColumnName|sequenceFixedWidth
                                                                    netField = args[0].ToString().Trim();
                                                                    netRestrictFC = args[1].ToString().Trim();
                                                                    break;
                                                                case 3:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                    netField = args[0].ToString().Trim();
                                                                    netRestrictFC = args[1].ToString().Trim();
                                                                    netRestrictField = args[2].ToString().Trim();
                                                                    break;
                                                                case 4:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                    netField = args[0].ToString().Trim();
                                                                    netRestrictFC = args[1].ToString().Trim();
                                                                    netRestrictField = args[2].ToString().Trim();
                                                                    netRestrictValue = args[3].ToString().Trim();
                                                                    break;
                                                                default: break;
                                                            }

                                                            iJuncFeat = (IJunctionFeature)netFeat;
                                                            // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                                            ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                                            if (iSJunc == null)
                                                                break;
                                                            if (iSJunc.EdgeFeatureCount <= 0)
                                                                break;
                                                            if (iSJunc.EdgeFeatureCount > 0)
                                                            {
                                                                for (int i = 0; i < iSJunc.EdgeFeatureCount; i++)
                                                                {
                                                                    iEdgeFeat = iSJunc.get_EdgeFeature(i);
                                                                    try
                                                                    {
                                                                        if (netRestrictFC != "")
                                                                        {
                                                                            string strClsName = Globals.getClassName(((IDataset)((IFeature)iEdgeFeat).Class));

                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bf") + strClsName);
                                                                            if (strClsName != netRestrictFC)
                                                                            {
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bg"));
                                                                                continue;
                                                                            }
                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bh"));
                                                                            if (netRestrictField != "" && netRestrictValue != "")
                                                                            {
                                                                                int intTmpFld = Globals.GetFieldIndex(((IFeature)iEdgeFeat).Fields, netRestrictField);

                                                                                if (intTmpFld > -1)
                                                                                {
                                                                                    //IFeature pTest = ((IFeature)iEdgeFeat);

                                                                                    if (((IFeature)iEdgeFeat).get_Value(intTmpFld).ToString() == netRestrictValue)
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bl"));
                                                                                        continue;

                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine("                  " + netRestrictField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bm"));
                                                                            }
                                                                        }

                                                                        iJuncFeat = iEdgeFeat.ToJunctionFeature;
                                                                        if (((IFeature)iJuncFeat).Shape.Equals(inFeature.Shape))
                                                                        {
                                                                            IRow pRow = iEdgeFeat as IRow;

                                                                            // verify that field (in junction) to copy exists
                                                                            juncField = Globals.GetFieldIndex(pRow.Fields, netField);

                                                                            if (juncField > -1)
                                                                            {
                                                                                inObject.set_Value(intFldIdxs[0], pRow.get_Value(juncField));
                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine("                  " + iSJunc + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14am") );
                                                                            }
                                                                            pRow = null;

                                                                            break;

                                                                        }
                                                                    }
                                                                    catch
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14an"));
                                                                    }

                                                                }

                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bi"));
                                                            }
                                                            iSJunc = null;
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bj"));
                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bk"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "FROM_EDGE_FIELD: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "FROM_EDGE_FIELD");
                                            }
                                            break;

                                        case "TO_EDGE_STATS":
                                            try
                                            {
                                                if (valData == null) break;
                                                args = valData.Split('|');
                                                string statType = "MAX";
                                                switch (args.GetLength(0))
                                                {
                                                    case 1:
                                                        sourceFieldName = args[0].ToString();
                                                        break;
                                                    case 2:
                                                        sourceFieldName = args[0].ToString();
                                                        statType = args[1].ToString();
                                                        break;

                                                    default: break;
                                                }

                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "TO_EDGE_STATS");

                                                int AverageCount = 0;
                                                double result = -999999.1;
                                                string textRes = "";
                                                if (inFeature != null)
                                                {
                                                    netFeat = inFeature as INetworkFeature;
                                                    if (netFeat != null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain103"));
                                                        if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain104"));
                                                            iJuncFeat = (IJunctionFeature)netFeat;
                                                            // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                                            ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                                            if (iSJunc == null)
                                                                break;
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain105") + iSJunc.EdgeFeatureCount);
                                                            if (iSJunc.EdgeFeatureCount <= 0)
                                                                break;
                                                            if (iSJunc.EdgeFeatureCount > 0)
                                                            {
                                                                for (int i = 0; i < iSJunc.EdgeFeatureCount; i++)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain105") + iSJunc.EdgeFeatureCount);

                                                                    iEdgeFeat = iSJunc.get_EdgeFeature(i);
                                                                    try
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain106"));

                                                                        iJuncFeat = iEdgeFeat.FromJunctionFeature;

                                                                        if (((IFeature)iJuncFeat).Shape.Equals(inFeature.Shape))
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain107"));

                                                                            IRow pRow = iEdgeFeat as IRow;

                                                                            // verify that field (in junction) to copy exists
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain108"));
                                                                            juncField = pRow.Fields.FindField(sourceFieldName);
                                                                            string test = pRow.get_Value(juncField).ToString();
                                                                            if (Globals.IsNumeric(test))
                                                                            {

                                                                                double valToTest = Convert.ToDouble(test);
                                                                                if (result == -999999.1)
                                                                                {
                                                                                    result = valToTest;

                                                                                }
                                                                                else
                                                                                {
                                                                                    switch (statType.ToUpper())
                                                                                    {
                                                                                        case "MAX":
                                                                                            if (result < valToTest)
                                                                                            {
                                                                                                result = valToTest;

                                                                                            }
                                                                                            break;
                                                                                        case "MIN":
                                                                                            if (result > valToTest)
                                                                                            {
                                                                                                result = valToTest;

                                                                                            }
                                                                                            break;
                                                                                        case "SUM":
                                                                                            result += valToTest;

                                                                                            break;
                                                                                        case "AVERAGE":
                                                                                            result += valToTest;
                                                                                            AverageCount++;
                                                                                            break;
                                                                                        case "MEAN":
                                                                                            result += valToTest;
                                                                                            AverageCount++;

                                                                                            break;
                                                                                        case "CONCAT":
                                                                                            if (textRes.Contains(valToTest.ToString() + ConcatDelim))
                                                                                            {
                                                                                            }
                                                                                            else if (textRes.Contains(ConcatDelim + valToTest.ToString()))
                                                                                            {
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                if (textRes == "")
                                                                                                {
                                                                                                    textRes += valToTest.ToString();
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    textRes += ConcatDelim + valToTest.ToString();
                                                                                                }
                                                                                            }

                                                                                            break;
                                                                                        default:
                                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ai") + test);
                                                                                            break;
                                                                                    }

                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                switch (statType.ToUpper())
                                                                                {

                                                                                    case "CONCAT":
                                                                                        if (textRes.Contains(test.ToString() + ConcatDelim))
                                                                                        {
                                                                                        }
                                                                                        else if (textRes.Contains(ConcatDelim + test.ToString()))
                                                                                        {
                                                                                        }
                                                                                        else
                                                                                        {

                                                                                            if (textRes == "")
                                                                                            {
                                                                                                textRes += test;
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                textRes += ConcatDelim + test;
                                                                                            }
                                                                                        }

                                                                                        break;
                                                                                    default:
                                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14d") + test);

                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ai") + test);
                                                                                        break;
                                                                                }

                                                                            }

                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain109"));

                                                                        }
                                                                    }
                                                                    catch
                                                                    {
                                                                    }
                                                                }//end loop
                                                                try
                                                                {
                                                                    if (textRes != "")
                                                                    {
                                                                        inObject.set_Value(intFldIdxs[0], textRes);
                                                                    }
                                                                    else if (result != -999999.1)
                                                                    {
                                                                        if (AverageCount != 0)
                                                                        {
                                                                            result = result / AverageCount;
                                                                        }
                                                                        inObject.set_Value(intFldIdxs[0], result);

                                                                    }
                                                                    else
                                                                    {
                                                                        IField field = inObject.Fields.get_Field(intFldIdxs[0]);
                                                                        object newval = field.DefaultValue;
                                                                        if (newval == null)
                                                                        {
                                                                            if (field.IsNullable)
                                                                            {
                                                                                inObject.set_Value(intFldIdxs[0], null);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            inObject.set_Value(intFldIdxs[0], newval);
                                                                        }
                                                                    }
                                                                }
                                                                catch (Exception ex)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aj") + ex.Message);

                                                                }

                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bi"));
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bj"));
                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bk"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TO_EDGE_STATS: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TO_EDGE_STATS");
                                            }
                                            break;

                                        case "FROM_EDGE_STATS":
                                            try
                                            {
                                                if (valData == null) break;
                                                args = valData.Split('|');
                                                string statType = "MAX";
                                                switch (args.GetLength(0))
                                                {
                                                    case 1:
                                                        sourceFieldName = args[0].ToString();
                                                        break;
                                                    case 2:
                                                        sourceFieldName = args[0].ToString();
                                                        statType = args[1].ToString();
                                                        break;

                                                    default: break;
                                                }

                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "FROM_EDGE_STATS");

                                                int AverageCount = 0;
                                                double result = -999999.1;
                                                string textRes = "";
                                                if (inFeature != null)
                                                {
                                                    netFeat = inFeature as INetworkFeature;
                                                    if (netFeat != null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain103"));
                                                        if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain104"));
                                                            iJuncFeat = (IJunctionFeature)netFeat;
                                                            // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                                            ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                                            if (iSJunc == null)
                                                                break;
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain105") + iSJunc.EdgeFeatureCount);
                                                            if (iSJunc.EdgeFeatureCount <= 0)
                                                                break;
                                                            if (iSJunc.EdgeFeatureCount > 0)
                                                            {
                                                                for (int i = 0; i < iSJunc.EdgeFeatureCount; i++)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain105") + iSJunc.EdgeFeatureCount);

                                                                    iEdgeFeat = iSJunc.get_EdgeFeature(i);
                                                                    try
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain106"));

                                                                        iJuncFeat = iEdgeFeat.ToJunctionFeature;

                                                                        if (((IFeature)iJuncFeat).Shape.Equals(inFeature.Shape))
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain110"));

                                                                            IRow pRow = iEdgeFeat as IRow;

                                                                            // verify that field (in junction) to copy exists
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain111"));
                                                                            juncField = pRow.Fields.FindField(sourceFieldName);
                                                                            string test = pRow.get_Value(juncField).ToString();
                                                                            if (Globals.IsNumeric(test))
                                                                            {

                                                                                double valToTest = Convert.ToDouble(test);
                                                                                if (result == -999999.1)
                                                                                {
                                                                                    result = valToTest;

                                                                                }
                                                                                else
                                                                                {
                                                                                    switch (statType.ToUpper())
                                                                                    {
                                                                                        case "MAX":
                                                                                            if (result < valToTest)
                                                                                            {
                                                                                                result = valToTest;

                                                                                            }
                                                                                            break;
                                                                                        case "MIN":
                                                                                            if (result > valToTest)
                                                                                            {
                                                                                                result = valToTest;

                                                                                            }
                                                                                            break;
                                                                                        case "SUM":
                                                                                            result += valToTest;

                                                                                            break;
                                                                                        case "AVERAGE":
                                                                                            result += valToTest;
                                                                                            AverageCount++;
                                                                                            break;
                                                                                        case "MEAN":
                                                                                            result += valToTest;
                                                                                            AverageCount++;

                                                                                            break;
                                                                                        case "CONCAT":
                                                                                            if (textRes.Contains(valToTest.ToString() + ConcatDelim))
                                                                                            {
                                                                                            }
                                                                                            else if (textRes.Contains(ConcatDelim + valToTest.ToString()))
                                                                                            {
                                                                                            }
                                                                                            else
                                                                                            {

                                                                                                if (textRes == "")
                                                                                                {
                                                                                                    textRes += valToTest.ToString();
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    textRes += ConcatDelim + valToTest.ToString();
                                                                                                }

                                                                                            }

                                                                                            break;
                                                                                        default:
                                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ai") + test);
                                                                                            break;
                                                                                    }

                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                switch (statType.ToUpper())
                                                                                {

                                                                                    case "CONCAT":
                                                                                        if (textRes.Contains(test.ToString() + ConcatDelim))
                                                                                        {
                                                                                        }
                                                                                        else if (textRes.Contains(ConcatDelim + test.ToString()))
                                                                                        {
                                                                                        }
                                                                                        else
                                                                                        {

                                                                                            if (textRes == "")
                                                                                            {
                                                                                                textRes += test;
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                textRes += ConcatDelim + test;
                                                                                            }

                                                                                        }

                                                                                        break;
                                                                                    default:
                                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14d") + test);

                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ai") + test);
                                                                                        break;
                                                                                }

                                                                            }

                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain112"));

                                                                        }
                                                                    }
                                                                    catch
                                                                    {
                                                                    }
                                                                }//end loop
                                                                try
                                                                {
                                                                    if (textRes != "")
                                                                    {
                                                                        inObject.set_Value(intFldIdxs[0], textRes);
                                                                    }
                                                                    else if (result != -999999.1)
                                                                    {
                                                                        if (AverageCount != 0)
                                                                        {
                                                                            result = result / AverageCount;
                                                                        }
                                                                        inObject.set_Value(intFldIdxs[0], result);

                                                                    }
                                                                    else
                                                                    {
                                                                        IField field = inObject.Fields.get_Field(intFldIdxs[0]);
                                                                        object newval = field.DefaultValue;
                                                                        if (newval == null)
                                                                        {
                                                                            if (field.IsNullable)
                                                                            {
                                                                                inObject.set_Value(intFldIdxs[0], null);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            inObject.set_Value(intFldIdxs[0], newval);
                                                                        }
                                                                    }
                                                                }
                                                                catch (Exception ex)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aj") + ex.Message);

                                                                }

                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bi"));
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bj"));
                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bk"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TO_EDGE_STATS: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TO_EDGE_STATS");
                                            }
                                            break;

                                        case "EDGE_STATS":
                                            try
                                            {
                                                if (valData == null) break;
                                                args = valData.Split('|');
                                                string statType = "MAX";
                                                switch (args.GetLength(0))
                                                {
                                                    case 1:
                                                        sourceFieldName = args[0].ToString();
                                                        break;
                                                    case 2:
                                                        sourceFieldName = args[0].ToString();
                                                        statType = args[1].ToString();
                                                        break;

                                                    default: break;
                                                }

                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "EDGE_STATS");

                                                int AverageCount = 0;
                                                double result = -999999.1;
                                                string textRes = "";
                                                if (inFeature != null)
                                                {
                                                    netFeat = inFeature as INetworkFeature;
                                                    if (netFeat != null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain103"));
                                                        if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain104"));
                                                            iJuncFeat = (IJunctionFeature)netFeat;
                                                            // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                                            ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                                            if (iSJunc == null)
                                                                break;
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain105") + iSJunc.EdgeFeatureCount);
                                                            if (iSJunc.EdgeFeatureCount <= 0)
                                                                break;
                                                            if (iSJunc.EdgeFeatureCount > 0)
                                                            {
                                                                for (int i = 0; i < iSJunc.EdgeFeatureCount; i++)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain105") + iSJunc.EdgeFeatureCount);

                                                                    iEdgeFeat = iSJunc.get_EdgeFeature(i);
                                                                    try
                                                                    {

                                                                        IRow pRow = iEdgeFeat as IRow;

                                                                        // verify that field (in junction) to copy exists
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain113"));
                                                                        juncField = pRow.Fields.FindField(sourceFieldName);
                                                                        string test = pRow.get_Value(juncField).ToString();
                                                                        if (Globals.IsNumeric(test))
                                                                        {

                                                                            double valToTest = Convert.ToDouble(test);
                                                                            if (result == -999999.1)
                                                                            {
                                                                                result = valToTest;

                                                                            }
                                                                            else
                                                                            {
                                                                                switch (statType.ToUpper())
                                                                                {
                                                                                    case "MAX":
                                                                                        if (result < valToTest)
                                                                                        {
                                                                                            result = valToTest;

                                                                                        }
                                                                                        break;
                                                                                    case "MIN":
                                                                                        if (result > valToTest)
                                                                                        {
                                                                                            result = valToTest;

                                                                                        }
                                                                                        break;
                                                                                    case "SUM":
                                                                                        result += valToTest;

                                                                                        break;
                                                                                    case "AVERAGE":
                                                                                        result += valToTest;
                                                                                        AverageCount++;
                                                                                        break;
                                                                                    case "MEAN":
                                                                                        result += valToTest;
                                                                                        AverageCount++;

                                                                                        break;
                                                                                    case "CONCAT":
                                                                                        if (textRes.Contains(valToTest.ToString() + ConcatDelim))
                                                                                        {
                                                                                        }
                                                                                        else if (textRes.Contains(ConcatDelim + valToTest.ToString()))
                                                                                        {
                                                                                        }
                                                                                        else
                                                                                        {

                                                                                            if (textRes == "")
                                                                                            {
                                                                                                textRes += valToTest.ToString();
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                textRes += ConcatDelim + valToTest.ToString();
                                                                                            }

                                                                                        }

                                                                                        break;
                                                                                    default:
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ai") + test);
                                                                                        break;
                                                                                }

                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            switch (statType.ToUpper())
                                                                            {

                                                                                case "CONCAT":
                                                                                    if (textRes.Contains(test.ToString() + ConcatDelim))
                                                                                    {
                                                                                    }
                                                                                    else if (textRes.Contains(ConcatDelim + test.ToString()))
                                                                                    {
                                                                                    }
                                                                                    else
                                                                                    {

                                                                                        if (textRes == "")
                                                                                        {
                                                                                            textRes += test;
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            textRes += ConcatDelim + test;
                                                                                        }
                                                                                    }

                                                                                    break;
                                                                                default:
                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14d") + test);

                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ai") + test);
                                                                                    break;
                                                                            }

                                                                        }

                                                                    }
                                                                    catch
                                                                    {
                                                                    }
                                                                }//end loop
                                                                try
                                                                {
                                                                    if (textRes != "")
                                                                    {
                                                                        inObject.set_Value(intFldIdxs[0], textRes);
                                                                    }
                                                                    else if (result != -999999.1)
                                                                    {
                                                                        if (AverageCount != 0)
                                                                        {
                                                                            result = result / AverageCount;
                                                                        }
                                                                        inObject.set_Value(intFldIdxs[0], result);

                                                                    }
                                                                    else
                                                                    {
                                                                        IField field = inObject.Fields.get_Field(intFldIdxs[0]);
                                                                        object newval = field.DefaultValue;
                                                                        if (newval == null)
                                                                        {
                                                                            if (field.IsNullable)
                                                                            {
                                                                                inObject.set_Value(intFldIdxs[0], null);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            inObject.set_Value(intFldIdxs[0], newval);
                                                                        }
                                                                    }
                                                                }
                                                                catch (Exception ex)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aj") + ex.Message);

                                                                }

                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bi"));
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bj"));
                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bk"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TO_EDGE_STATS: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TO_EDGE_STATS");
                                            }
                                            break;
                                        case "TO_EDGE_MULTI_FIELD_INTERSECT":
                                            try
                                            {
                                                if (valData == null) break;

                                                sourceFieldName = "";
                                                sourceField = -1;
                                                found = false;
                                                //LayerToIntersect|Field To Elevate
                                                // Parse arguments
                                                args = valData.Split('|');
                                                int popFldIdx = 0;
                                                if (args.GetLength(0) >= 2)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain114"));

                                                    sourceFieldName = args[0].ToString();
                                                    string[] fieldsToPop = args[1].ToString().Split(',');

                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "TO_EDGE_MULTI_FIELD_INTERSECT");

                                                    if (inFeature != null)
                                                    {
                                                        netFeat = inFeature as INetworkFeature;
                                                        if (netFeat != null)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain103"));
                                                            if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain104"));
                                                                iJuncFeat = (IJunctionFeature)netFeat;
                                                                // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                                                ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                                                if (iSJunc == null)
                                                                    break;
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain105") + iSJunc.EdgeFeatureCount);
                                                                if (iSJunc.EdgeFeatureCount <= 0)
                                                                    break;
                                                                if (iSJunc.EdgeFeatureCount > 0)
                                                                {
                                                                    for (int i = 0; i < iSJunc.EdgeFeatureCount; i++)
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain105") + iSJunc.EdgeFeatureCount);

                                                                        iEdgeFeat = iSJunc.get_EdgeFeature(i);
                                                                        try
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain106"));

                                                                            iJuncFeat = iEdgeFeat.FromJunctionFeature;

                                                                            if (((IFeature)iJuncFeat).Shape.Equals(inFeature.Shape))
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain107"));

                                                                                IRow pRow = iEdgeFeat as IRow;

                                                                                // verify that field (in junction) to copy exists
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain108"));
                                                                                juncField = pRow.Fields.FindField(sourceFieldName);
                                                                                string test = pRow.get_Value(juncField).ToString();
                                                                                if (fieldsToPop.Length == popFldIdx)
                                                                                    break;

                                                                                int tempFieldNum = inObject.Fields.FindField(fieldsToPop[popFldIdx]);

                                                                                if (tempFieldNum > -1)
                                                                                {
                                                                                    inObject.set_Value(tempFieldNum, test);
                                                                                    popFldIdx++;
                                                                                }

                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain109"));

                                                                            }
                                                                        }
                                                                        catch
                                                                        {
                                                                        }
                                                                    }//end loop

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bi"));
                                                                }

                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bj"));
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bk"));
                                                        }
                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TO_EDGE_STATS: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TO_EDGE_STATS");
                                            }
                                            break;
                                        case "FROM_EDGE_MULTI_FIELD_INTERSECT":
                                            try
                                            {
                                                if (valData == null) break;
                                                sourceFieldName = "";
                                                sourceField = -1;
                                                found = false;
                                                //LayerToIntersect|Field To Elevate
                                                // Parse arguments
                                                args = valData.Split('|');
                                                int popFldIdx = 0;
                                                if (args.GetLength(0) >= 2)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain114"));

                                                    sourceFieldName = args[0].ToString();
                                                    string[] fieldsToPop = args[1].ToString().Split(',');

                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "FROM_EDGE_MULTI_FIELD_INTERSECT");

                                                    if (inFeature != null)
                                                    {
                                                        netFeat = inFeature as INetworkFeature;
                                                        if (netFeat != null)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain103"));
                                                            if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain104"));
                                                                iJuncFeat = (IJunctionFeature)netFeat;
                                                                // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                                                ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                                                if (iSJunc == null)
                                                                    break;
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain105") + iSJunc.EdgeFeatureCount);
                                                                if (iSJunc.EdgeFeatureCount <= 0)
                                                                    break;
                                                                if (iSJunc.EdgeFeatureCount > 0)
                                                                {
                                                                    for (int i = 0; i < iSJunc.EdgeFeatureCount; i++)
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain105") + iSJunc.EdgeFeatureCount);

                                                                        iEdgeFeat = iSJunc.get_EdgeFeature(i);
                                                                        try
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain106"));

                                                                            iJuncFeat = iEdgeFeat.ToJunctionFeature;

                                                                            if (((IFeature)iJuncFeat).Shape.Equals(inFeature.Shape))
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain110"));

                                                                                IRow pRow = iEdgeFeat as IRow;

                                                                                // verify that field (in junction) to copy exists
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain111"));
                                                                                juncField = pRow.Fields.FindField(sourceFieldName);
                                                                                string test = pRow.get_Value(juncField).ToString();
                                                                                if (fieldsToPop.Length == popFldIdx)
                                                                                    break;

                                                                                int tempFieldNum = inObject.Fields.FindField(fieldsToPop[popFldIdx]);

                                                                                if (tempFieldNum > -1)
                                                                                {
                                                                                    inObject.set_Value(tempFieldNum, test);
                                                                                    popFldIdx++;
                                                                                }

                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain112"));

                                                                            }
                                                                        }
                                                                        catch
                                                                        {
                                                                        }
                                                                    }//end loop

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bi"));
                                                                }

                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bj"));
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bk"));
                                                        }
                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TO_EDGE_STATS: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TO_EDGE_STATS");
                                            }
                                            break;

                                        case "FROM_JUNCTION_FIELD":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "FROM_JUNCTION_FIELD");
                                                if (valData == null)
                                                {
                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ba"));
                                                    break;
                                                }
                                                if (inFeature != null)
                                                {
                                                    netFeat = inFeature as INetworkFeature;
                                                    if (netFeat != null)
                                                    {
                                                        if (inFeature.FeatureType == esriFeatureType.esriFTComplexEdge || inFeature.FeatureType == esriFeatureType.esriFTSimpleEdge)
                                                        {
                                                            string netField = "";
                                                            string netRestrictFC = "";
                                                            string netRestrictField = "";
                                                            string netRestrictValue = "";
                                                            args = valData.Split('|');
                                                            switch (args.GetLength(0))
                                                            {
                                                                case 1:  // sequenceColumnName only
                                                                    netField = args[0].ToString().Trim();
                                                                    break;
                                                                case 2:  // sequenceColumnName|sequenceFixedWidth
                                                                    netField = args[0].ToString().Trim();
                                                                    netRestrictFC = args[1].ToString().Trim();
                                                                    break;
                                                                case 3:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                    netField = args[0].ToString().Trim();
                                                                    netRestrictFC = args[1].ToString().Trim();
                                                                    netRestrictField = args[2].ToString().Trim();
                                                                    break;
                                                                case 4:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                    netField = args[0].ToString().Trim();
                                                                    netRestrictFC = args[1].ToString().Trim();
                                                                    netRestrictField = args[2].ToString().Trim();
                                                                    netRestrictValue = args[3].ToString().Trim();
                                                                    break;
                                                                default: break;
                                                            }

                                                            iEdgeFeat = (IEdgeFeature)netFeat;
                                                            iJuncFeat = iEdgeFeat.FromJunctionFeature;
                                                            if (netRestrictFC != "")
                                                            {
                                                                string strClsName = Globals.getClassName(((IDataset)((IFeature)iJuncFeat).Class));

                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bf") + strClsName);
                                                                if (strClsName != netRestrictFC)
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bg"));
                                                                    break;
                                                                }
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bh"));
                                                                if (netRestrictField != "" && netRestrictValue != "")
                                                                {
                                                                    int intTmpFld = Globals.GetFieldIndex(((IFeature)iJuncFeat).Fields, netRestrictField);

                                                                    if (intTmpFld > -1)
                                                                    {
                                                                        if (((IFeature)iJuncFeat).get_Value(intTmpFld).ToString() == netRestrictValue)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bl"));
                                                                            break;

                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  " + netRestrictField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bm"));
                                                                }
                                                            }
                                                            // verify that field (in junction) to copy exists
                                                            juncField = Globals.GetFieldIndex(((IFeature)iJuncFeat).Fields, netField);
                                                            if (juncField > -1)
                                                            {
                                                                inObject.set_Value(intFldIdxs[0], ((IFeature)iJuncFeat).get_Value(juncField));
                                                            }
                                                            else
                                                                AAState.WriteLine("                  " + netField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14am") );
                                                        }
                                                        else
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bc"));
                                                    }
                                                    else
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain115"));
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "FROM_JUNCTION_FIELD: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "FROM_JUNCTION_FIELD");
                                            }
                                            break;

                                        //Release: 1.2
                                        //New Dynamic Value Method: TO_JUNCTION_FIELD transfers a field value from a junction connected at terminal end of a line feature
                                        case "TO_JUNCTION_FIELD":
                                            try
                                            {

                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "TO_JUNCTION_FIELD");
                                                if (valData == null)
                                                {
                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ba"));
                                                    break;
                                                }
                                                if (inFeature != null)
                                                {

                                                    netFeat = inFeature as INetworkFeature;
                                                    if (netFeat != null)
                                                    {
                                                        if (inFeature.FeatureType == esriFeatureType.esriFTComplexEdge || inFeature.FeatureType == esriFeatureType.esriFTSimpleEdge)
                                                        {

                                                            string netField = "";
                                                            string netRestrictFC = "";
                                                            string netRestrictField = "";
                                                            string netRestrictValue = "";
                                                            args = valData.Split('|');
                                                            switch (args.GetLength(0))
                                                            {
                                                                case 1:  // sequenceColumnName only
                                                                    netField = args[0].ToString().Trim();
                                                                    break;
                                                                case 2:  // sequenceColumnName|sequenceFixedWidth
                                                                    netField = args[0].ToString().Trim();
                                                                    netRestrictFC = args[1].ToString().Trim();
                                                                    break;
                                                                case 3:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                    netField = args[0].ToString().Trim();
                                                                    netRestrictFC = args[1].ToString().Trim();
                                                                    netRestrictField = args[2].ToString().Trim();
                                                                    break;
                                                                case 4:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                    netField = args[0].ToString().Trim();
                                                                    netRestrictFC = args[1].ToString().Trim();
                                                                    netRestrictField = args[2].ToString().Trim();
                                                                    netRestrictValue = args[3].ToString().Trim();
                                                                    break;
                                                                default: break;
                                                            }

                                                            iEdgeFeat = (IEdgeFeature)netFeat;
                                                            iJuncFeat = iEdgeFeat.ToJunctionFeature;

                                                            if (netRestrictFC != "")
                                                            {
                                                                string strClsName = Globals.getClassName(((IDataset)((IFeature)iJuncFeat).Class));

                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bf") + strClsName);
                                                                if (strClsName != netRestrictFC)
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bg"));
                                                                    break;
                                                                }
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bh"));
                                                                if (netRestrictField != "" && netRestrictValue != "")
                                                                {
                                                                    int intTmpFld = Globals.GetFieldIndex(((IFeature)iJuncFeat).Fields, netRestrictField);

                                                                    if (intTmpFld > -1)
                                                                    {
                                                                        if (((IFeature)iJuncFeat).get_Value(intTmpFld).ToString() == netRestrictValue)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bl"));
                                                                            break;

                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  " + netRestrictField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bm"));
                                                                }
                                                            }
                                                            // verify that field (in junction) to copy exists
                                                            juncField = Globals.GetFieldIndex(((IFeature)iJuncFeat).Fields, netField);

                                                            //juncField = ((IFeature)iJuncFeat).Fields.FindField(valData as string);
                                                            if (juncField > -1)
                                                            {
                                                                inObject.set_Value(intFldIdxs[0], ((IFeature)iJuncFeat).get_Value(juncField));
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + netField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14am") );
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bc"));
                                                    }
                                                }
                                                else
                                                {
                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bd"));
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TO_JUNCTION_FIELD: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TO_JUNCTION_FIELD");
                                            }
                                            break;
                                        case "UPDATE_TO_JUNCTION_FIELD":
                                            try
                                            {

                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "UPDATE_TO_JUNCTION_FIELD");
                                                IRowChanges pRowCh = null;

                                                pRowCh = inObject as IRowChanges;

                                                if (pRowCh.get_ValueChanged(intFldIdxs[0]) == true)
                                                {

                                                    if (valData == null)
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ba"));
                                                        break;
                                                    }
                                                    if (inFeature != null)
                                                    {

                                                        netFeat = inFeature as INetworkFeature;
                                                        if (netFeat != null)
                                                        {
                                                            if (inFeature.FeatureType == esriFeatureType.esriFTComplexEdge || inFeature.FeatureType == esriFeatureType.esriFTSimpleEdge)
                                                            {

                                                                string netField = "";
                                                                string netRestrictFC = "";
                                                                string netRestrictField = "";
                                                                string netRestrictValue = "";
                                                                args = valData.Split('|');
                                                                switch (args.GetLength(0))
                                                                {
                                                                    case 1:  // sequenceColumnName only
                                                                        netField = args[0].ToString().Trim();
                                                                        break;
                                                                    case 2:  // sequenceColumnName|sequenceFixedWidth
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        break;
                                                                    case 3:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        break;
                                                                    case 4:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        netRestrictValue = args[3].ToString().Trim();
                                                                        break;
                                                                    default: break;
                                                                }

                                                                iEdgeFeat = (IEdgeFeature)netFeat;
                                                                iJuncFeat = iEdgeFeat.ToJunctionFeature;

                                                                if (netRestrictFC != "")
                                                                {
                                                                    string strClsName = Globals.getClassName(((IDataset)((IFeature)iJuncFeat).Class));

                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bf") + strClsName);
                                                                    if (strClsName != netRestrictFC)
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bg"));
                                                                        break;
                                                                    }
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bh"));
                                                                    if (netRestrictField != "" && netRestrictValue != "")
                                                                    {
                                                                        int intTmpFld = Globals.GetFieldIndex(((IFeature)iJuncFeat).Fields, netRestrictField);

                                                                        if (intTmpFld > -1)
                                                                        {
                                                                            if (((IFeature)iJuncFeat).get_Value(intTmpFld).ToString() == netRestrictValue)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bl"));
                                                                                break;

                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine("                  " + netRestrictField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bm"));
                                                                    }
                                                                }
                                                                // verify that field (in junction) to copy exists
                                                                juncField = Globals.GetFieldIndex(((IFeature)iJuncFeat).Fields, netField);

                                                                //juncField = ((IFeature)iJuncFeat).Fields.FindField(valData as string);
                                                                if (juncField > -1)
                                                                {
                                                                    if (ChangeFeatureList == null)
                                                                    {
                                                                        ChangeFeatureList = new List<IObject>();
                                                                    }
                                                                    ((IFeature)iJuncFeat).set_Value(juncField, inObject.get_Value(intFldIdxs[0]));
                                                                    ChangeFeatureList.Add(((IFeature)iJuncFeat));

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + netField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14am") );
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bc"));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bd"));
                                                    }
                                                }
                                                else
                                                {
                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14be"));
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "UPDATE_TO_JUNCTION_FIELD: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "UPDATE_TO_JUNCTION_FIELD");
                                            }
                                            break;
                                        case "UPDATE_FROM_JUNCTION_FIELD":
                                            try
                                            {

                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "UPDATE_FROM_JUNCTION_FIELD");
                                                IRowChanges pRowCh = null;

                                                pRowCh = inObject as IRowChanges;

                                                if (pRowCh.get_ValueChanged(intFldIdxs[0]) == true)
                                                {

                                                    if (valData == null)
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ba"));
                                                        break;
                                                    }
                                                    if (inFeature != null)
                                                    {

                                                        netFeat = inFeature as INetworkFeature;
                                                        if (netFeat != null)
                                                        {
                                                            if (inFeature.FeatureType == esriFeatureType.esriFTComplexEdge || inFeature.FeatureType == esriFeatureType.esriFTSimpleEdge)
                                                            {

                                                                string netField = "";
                                                                string netRestrictFC = "";
                                                                string netRestrictField = "";
                                                                string netRestrictValue = "";
                                                                args = valData.Split('|');
                                                                switch (args.GetLength(0))
                                                                {
                                                                    case 1:
                                                                        netField = args[0].ToString().Trim();
                                                                        break;
                                                                    case 2:
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        break;
                                                                    case 3:
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        break;
                                                                    case 4:
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        netRestrictValue = args[3].ToString().Trim();
                                                                        break;
                                                                    default: break;
                                                                }

                                                                iEdgeFeat = (IEdgeFeature)netFeat;
                                                                iJuncFeat = iEdgeFeat.FromJunctionFeature;

                                                                if (netRestrictFC != "")
                                                                {
                                                                    string strClsName = Globals.getClassName(((IDataset)((IFeature)iJuncFeat).Class));

                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bf") + strClsName);
                                                                    if (strClsName != netRestrictFC)
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bg"));
                                                                        break;
                                                                    }
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bh"));
                                                                    if (netRestrictField != "" && netRestrictValue != "")
                                                                    {
                                                                        int intTmpFld = Globals.GetFieldIndex(((IFeature)iJuncFeat).Fields, netRestrictField);

                                                                        if (intTmpFld > -1)
                                                                        {
                                                                            if (((IFeature)iJuncFeat).get_Value(intTmpFld).ToString() == netRestrictValue)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bl"));
                                                                                break;

                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine("                  " + netRestrictField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bm"));
                                                                    }
                                                                }
                                                                // verify that field (in junction) to copy exists
                                                                juncField = Globals.GetFieldIndex(((IFeature)iJuncFeat).Fields, netField);

                                                                //juncField = ((IFeature)iJuncFeat).Fields.FindField(valData as string);
                                                                if (juncField > -1)
                                                                {
                                                                    if (ChangeFeatureList == null)
                                                                    {
                                                                        ChangeFeatureList = new List<IObject>();
                                                                    }
                                                                    ((IFeature)iJuncFeat).set_Value(juncField, inObject.get_Value(intFldIdxs[0]));
                                                                    ChangeFeatureList.Add(((IFeature)iJuncFeat));

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + netField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14am") );
                                                                }
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bc"));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bd"));
                                                    }

                                                }
                                                else
                                                {
                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14be"));
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "UPDATE_FROM_JUNCTION_FIELD: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "UPDATE_FROM_JUNCTION_FIELD");
                                            }
                                            break;
                                        case "UPDATE_FROM_EDGE_FIELD":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "UPDATE_FROM_EDGE_FIELD");
                                                if (inFeature != null)
                                                {
                                                    IRowChanges pRowCh = null;

                                                    pRowCh = inObject as IRowChanges;

                                                    if (pRowCh.get_ValueChanged(intFldIdxs[0]) == true)
                                                    {

                                                        if (valData == null)
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ba"));
                                                            break;
                                                        }
                                                        netFeat = inFeature as INetworkFeature;
                                                        if (netFeat != null)
                                                        {
                                                            if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                                            {
                                                                string netField = "";
                                                                string netRestrictFC = "";
                                                                string netRestrictField = "";
                                                                string netRestrictValue = "";
                                                                args = valData.Split('|');
                                                                switch (args.GetLength(0))
                                                                {
                                                                    case 1:  // sequenceColumnName only
                                                                        netField = args[0].ToString().Trim();
                                                                        break;
                                                                    case 2:  // sequenceColumnName|sequenceFixedWidth
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        break;
                                                                    case 3:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        break;
                                                                    case 4:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        netRestrictValue = args[3].ToString().Trim();
                                                                        break;
                                                                    default: break;
                                                                }

                                                                iJuncFeat = (IJunctionFeature)netFeat;
                                                                // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                                                ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                                                if (iSJunc == null)
                                                                    break;
                                                                if (iSJunc.EdgeFeatureCount <= 0)
                                                                    break;
                                                                if (iSJunc.EdgeFeatureCount > 0)
                                                                {
                                                                    for (int i = 0; i < iSJunc.EdgeFeatureCount; i++)
                                                                    {
                                                                        iEdgeFeat = iSJunc.get_EdgeFeature(i);
                                                                        try
                                                                        {
                                                                            if (netRestrictFC != "")
                                                                            {
                                                                                string strClsName = Globals.getClassName(((IDataset)((IFeature)iEdgeFeat).Class));

                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bf") + strClsName);
                                                                                if (strClsName != netRestrictFC)
                                                                                {
                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bg"));
                                                                                    continue;
                                                                                }
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bh"));
                                                                                if (netRestrictField != "" && netRestrictValue != "")
                                                                                {
                                                                                    int intTmpFld = Globals.GetFieldIndex(((IFeature)iEdgeFeat).Fields, netRestrictField);

                                                                                    if (intTmpFld > -1)
                                                                                    {
                                                                                        //IFeature pTest = ((IFeature)iEdgeFeat);

                                                                                        if (((IFeature)iEdgeFeat).get_Value(intTmpFld).ToString() == netRestrictValue)
                                                                                        {
                                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bl"));
                                                                                            continue;

                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        AAState.WriteLine("                  " + netRestrictField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bm"));
                                                                                }
                                                                            }

                                                                            iJuncFeat = iEdgeFeat.ToJunctionFeature;
                                                                            if (((IFeature)iJuncFeat).Shape.Equals(inFeature.Shape))
                                                                            {
                                                                                IFeature pRow = iEdgeFeat as IFeature;

                                                                                // verify that field (in junction) to copy exists
                                                                                juncField = Globals.GetFieldIndex(pRow.Fields, netField);

                                                                                if (juncField > -1)
                                                                                {
                                                                                    if (ChangeFeatureList == null)
                                                                                    {
                                                                                        ChangeFeatureList = new List<IObject>();
                                                                                    }
                                                                                    pRow.set_Value(juncField, inObject.get_Value(intFldIdxs[0]));
                                                                                    ChangeFeatureList.Add(((IFeature)pRow));

                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine("                  " + iSJunc + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14am") );
                                                                                }
                                                                                pRow = null;

                                                                                break;

                                                                            }
                                                                        }
                                                                        catch
                                                                        {
                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14an"));
                                                                        }

                                                                    }

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bi"));
                                                                }
                                                                iSJunc = null;
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bj"));
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bk"));
                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14be"));
                                                    }

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "UPDATE_FROM_EDGE_FIELD: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "UPDATE_FROM_EDGE_FIELD");
                                            }
                                            break;
                                        case "UPDATE_TO_EDGE_FIELD":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "UPDATE_TO_EDGE_FIELD");
                                                if (inFeature != null)
                                                {
                                                    IRowChanges pRowCh = null;

                                                    pRowCh = inObject as IRowChanges;

                                                    if (pRowCh.get_ValueChanged(intFldIdxs[0]) == true)
                                                    {

                                                        if (valData == null)
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ba"));
                                                            break;
                                                        }
                                                        netFeat = inFeature as INetworkFeature;
                                                        if (netFeat != null)
                                                        {
                                                            if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                                            {
                                                                string netField = "";
                                                                string netRestrictFC = "";
                                                                string netRestrictField = "";
                                                                string netRestrictValue = "";
                                                                args = valData.Split('|');
                                                                switch (args.GetLength(0))
                                                                {
                                                                    case 1:  // sequenceColumnName only
                                                                        netField = args[0].ToString().Trim();
                                                                        break;
                                                                    case 2:  // sequenceColumnName|sequenceFixedWidth
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        break;
                                                                    case 3:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        break;
                                                                    case 4:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        netRestrictValue = args[3].ToString().Trim();
                                                                        break;
                                                                    default: break;
                                                                }

                                                                iJuncFeat = (IJunctionFeature)netFeat;
                                                                // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                                                ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                                                if (iSJunc == null)
                                                                    break;
                                                                if (iSJunc.EdgeFeatureCount <= 0)
                                                                    break;
                                                                if (iSJunc.EdgeFeatureCount > 0)
                                                                {
                                                                    for (int i = 0; i < iSJunc.EdgeFeatureCount; i++)
                                                                    {
                                                                        iEdgeFeat = iSJunc.get_EdgeFeature(i);
                                                                        try
                                                                        {

                                                                            if (netRestrictFC != "")
                                                                            {
                                                                                string strClsName = Globals.getClassName(((IDataset)((IFeature)iEdgeFeat).Class));

                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bf") + strClsName);
                                                                                if (strClsName != netRestrictFC)
                                                                                {
                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bg"));
                                                                                    continue;
                                                                                }
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bh"));
                                                                                if (netRestrictField != "" && netRestrictValue != "")
                                                                                {
                                                                                    int intTmpFld = Globals.GetFieldIndex(((IFeature)iEdgeFeat).Fields, netRestrictField);

                                                                                    if (intTmpFld > -1)
                                                                                    {
                                                                                        //IFeature pTest = ((IFeature)iEdgeFeat);

                                                                                        if (((IFeature)iEdgeFeat).get_Value(intTmpFld).ToString() == netRestrictValue)
                                                                                        {
                                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bl"));
                                                                                            continue;

                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        AAState.WriteLine("                  " + netRestrictField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bm"));
                                                                                }
                                                                            }

                                                                            iJuncFeat = (IJunctionFeature)iEdgeFeat.FromJunctionFeature;
                                                                            if (((IFeature)iJuncFeat).Shape.Equals(inFeature.Shape))
                                                                            {
                                                                                IFeature pRow = iEdgeFeat as IFeature;

                                                                                // verify that field (in junction) to copy exists
                                                                                juncField = Globals.GetFieldIndex(pRow.Fields, netField);

                                                                                if (juncField > -1)
                                                                                {
                                                                                    if (ChangeFeatureList == null)
                                                                                    {
                                                                                        ChangeFeatureList = new List<IObject>();
                                                                                    }
                                                                                    pRow.set_Value(juncField, inObject.get_Value(intFldIdxs[0]));
                                                                                    ChangeFeatureList.Add(((IFeature)pRow));

                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine("                  " + netField + " field not found in edge");
                                                                                }
                                                                                pRow = null;
                                                                                break;

                                                                            }
                                                                        }
                                                                        catch
                                                                        {
                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14an"));
                                                                        }

                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bi"));
                                                                }
                                                                iSJunc = null;
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bj"));
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bk"));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14be"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "UPDATE_TO_EDGE_FIELD: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "UPDATE_TO_EDGE_FIELD");
                                            }
                                            break;
                                        //***************8

                                        case "TRIGGER_UPDATE_INTERSECTING_FEATURE"://Intersected Feature|FieldIntersectingFeatureToChange|FromFieldinModifiedFeature
                                            {
                                                try
                                                {
                                                    IFeatureCursor fLocalCursor = null;
                                                    IFeature sourceFeatureLocal = null;
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "TRIGGER_UPDATE_INTERSECTING_FEATURE");
                                                    if (!String.IsNullOrEmpty(valData))
                                                    {
                                                        args = valData.Split('|');
                                                        if (args.Length != 3)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ad"));
                                                            break;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ad"));
                                                        break;
                                                    }
                                                    if (inFeature == null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ak"));
                                                        break;
                                                    }
                                                    bool cont = true;
                                                    if (intFldIdxs.Count > 1)
                                                    {
                                                        IRowChanges inChanges = inObject as IRowChanges;
                                                        if (inChanges.get_ValueChanged(intFldIdxs[0]))
                                                        {
                                                            cont = true;
                                                        }
                                                        else
                                                        {
                                                            cont = false;
                                                        }

                                                        inChanges = null;

                                                    }
                                                    if (cont)
                                                    {

                                                        sourceLayerName = "";
                                                        sourceFieldName = "";
                                                        sourceField = -1;
                                                        found = false;
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bs"));
                                                        sourceLayerNames = args[0].ToString().Split(',');
                                                        sourceFieldName = args[1].ToString().Trim();
                                                        string targetFieldName = args[2].ToString().Trim();
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bt"));
                                                        if (sourceFieldName != null)
                                                        {
                                                            for (int i = 0; i < sourceLayerNames.Length; i++)
                                                            {
                                                                sourceLayerName = sourceLayerNames[i].ToString().Trim();
                                                                if (sourceLayerName != "")
                                                                {

                                                                    boolLayerOrFC = true;
                                                                    if (sourceLayerName.Contains("("))
                                                                    {
                                                                        string[] tempSplt = sourceLayerName.Split('(');
                                                                        sourceLayerName = tempSplt[0].Trim();
                                                                        sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);
                                                                        if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);
                                                                    }
                                                                    if (sourceLayer != null)
                                                                    {

                                                                        if (Globals.IsEditable(ref sourceLayer, ref AAState._editor))
                                                                        {

                                                                            if (inObject.Class.ObjectClassID != sourceLayer.FeatureClass.ObjectClassID)
                                                                            {

                                                                                sFilter = Globals.createSpatialFilter(sourceLayer, inFeature, false);

                                                                                pFS = (IFeatureSelection)sourceLayer;
                                                                                if (boolLayerOrFC)
                                                                                {
                                                                                    if (pFS.SelectionSet.Count > 0)
                                                                                    {
                                                                                        pFS.SelectionSet.Search(sFilter, false, out cCurs);
                                                                                        fLocalCursor = cCurs as IFeatureCursor;

                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        fLocalCursor = sourceLayer.Search(sFilter, false);
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    fLocalCursor = sourceLayer.FeatureClass.Search(sFilter, false);
                                                                                }

                                                                                while ((sourceFeatureLocal = fLocalCursor.NextFeature()) != null)
                                                                                {
                                                                                    try
                                                                                    {
                                                                                        if (sourceFeatureLocal.Class.ObjectClassID != inFeature.Class.ObjectClassID)
                                                                                        {
                                                                                            if (sourceFieldName == "CREATE")
                                                                                            {
                                                                                                if (NewFeatureList == null)
                                                                                                {
                                                                                                    NewFeatureList = new List<IObject>();
                                                                                                }

                                                                                                NewFeatureList.Add(((IFeature)sourceFeatureLocal));
                                                                                            }
                                                                                            else if (sourceFieldName == "CHANGEGEO")
                                                                                            {
                                                                                                if (ChangeFeatureGeoList == null)
                                                                                                {
                                                                                                    ChangeFeatureGeoList = new List<IObject>();
                                                                                                }

                                                                                                ChangeFeatureGeoList.Add(((IFeature)sourceFeatureLocal));
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                if (ChangeFeatureList == null)
                                                                                                {
                                                                                                    ChangeFeatureList = new List<IObject>();
                                                                                                }

                                                                                                ChangeFeatureList.Add(((IFeature)sourceFeatureLocal));
                                                                                            }

                                                                                        }
                                                                                        else if (sourceFeatureLocal.Class == inFeature.Class && sourceFeatureLocal.OID != inFeature.OID)
                                                                                        {
                                                                                            if (sourceFieldName == "CREATE")
                                                                                            {
                                                                                                if (NewFeatureList == null)
                                                                                                {
                                                                                                    NewFeatureList = new List<IObject>();
                                                                                                }

                                                                                                NewFeatureList.Add(((IFeature)sourceFeatureLocal));
                                                                                            }
                                                                                            else if (sourceFieldName == "CHANGEGEO")
                                                                                            {
                                                                                                if (ChangeFeatureGeoList == null)
                                                                                                {
                                                                                                    ChangeFeatureGeoList = new List<IObject>();
                                                                                                }

                                                                                                ChangeFeatureGeoList.Add(((IFeature)sourceFeatureLocal));
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                if (ChangeFeatureList == null)
                                                                                                {
                                                                                                    ChangeFeatureList = new List<IObject>();
                                                                                                }

                                                                                                ChangeFeatureList.Add(((IFeature)sourceFeatureLocal));
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                    catch
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14al"));
                                                                                    }
                                                                                    finally
                                                                                    {

                                                                                    }

                                                                                }

                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14am") + sourceFieldName);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14am") + sourceFieldName);
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14b") + sourceLayerName);
                                                                    }

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14c") + sourceLayerName);
                                                                }
                                                            }
                                                        }
                                                        if (found)
                                                        {
                                                            break;

                                                        }

                                                    }
                                                    fLocalCursor = null;
                                                    sourceFeatureLocal = null;
                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TRIGGER_UPDATE_INTERSECTING_FEATURE" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TRIGGER_UPDATE_INTERSECTING_FEATURE");

                                                }
                                                break;

                                            }

                                        case "TRIGGER_UPDATE_TO_JUNCTION":
                                            try
                                            {

                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "TRIGGER_UPDATE_TO_JUNCTION");
                                                IRowChanges pRowCh = null;

                                                pRowCh = inObject as IRowChanges;

                                                if (pRowCh.get_ValueChanged(intFldIdxs[0]) == true)
                                                {

                                                    if (valData == null)
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ba"));
                                                        break;
                                                    }
                                                    if (inFeature != null)
                                                    {

                                                        netFeat = inFeature as INetworkFeature;
                                                        if (netFeat != null)
                                                        {
                                                            if (inFeature.FeatureType == esriFeatureType.esriFTComplexEdge || inFeature.FeatureType == esriFeatureType.esriFTSimpleEdge)
                                                            {

                                                                string netField = "";
                                                                string netRestrictFC = "";
                                                                string netRestrictField = "";
                                                                string netRestrictValue = "";
                                                                args = valData.Split('|');
                                                                switch (args.GetLength(0))
                                                                {
                                                                    case 1:  // sequenceColumnName only
                                                                        netField = args[0].ToString().Trim();
                                                                        break;
                                                                    case 2:  // sequenceColumnName|sequenceFixedWidth
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        break;
                                                                    case 3:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        break;
                                                                    case 4:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        netRestrictValue = args[3].ToString().Trim();
                                                                        break;
                                                                    default: break;
                                                                }

                                                                iEdgeFeat = (IEdgeFeature)netFeat;
                                                                iJuncFeat = iEdgeFeat.ToJunctionFeature;

                                                                if (netRestrictFC != "")
                                                                {
                                                                    string strClsName = Globals.getClassName(((IDataset)((IFeature)iJuncFeat).Class));

                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bf") + strClsName);
                                                                    if (strClsName != netRestrictFC)
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bg"));
                                                                        break;
                                                                    }
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bh"));
                                                                    if (netRestrictField != "" && netRestrictValue != "")
                                                                    {
                                                                        int intTmpFld = Globals.GetFieldIndex(((IFeature)iJuncFeat).Fields, netRestrictField);

                                                                        if (intTmpFld > -1)
                                                                        {
                                                                            if (((IFeature)iJuncFeat).get_Value(intTmpFld).ToString() == netRestrictValue)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bl"));
                                                                                break;

                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine("                  " + netRestrictField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bm"));
                                                                    }
                                                                }
                                                                // verify that field (in junction) to copy exists
                                                                if (netField == "CREATE")
                                                                {
                                                                    if (NewFeatureList == null)
                                                                    {
                                                                        NewFeatureList = new List<IObject>();
                                                                    }

                                                                    NewFeatureList.Add(((IFeature)iJuncFeat));
                                                                }
                                                                else if (netField == "CHANGEGEO")
                                                                {
                                                                    if (ChangeFeatureGeoList == null)
                                                                    {
                                                                        ChangeFeatureGeoList = new List<IObject>();
                                                                    }

                                                                    ChangeFeatureGeoList.Add(((IFeature)iJuncFeat));
                                                                }
                                                                else
                                                                {
                                                                    if (ChangeFeatureList == null)
                                                                    {
                                                                        ChangeFeatureList = new List<IObject>();
                                                                    }

                                                                    ChangeFeatureList.Add(((IFeature)iJuncFeat));
                                                                }

                                                            }
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bc"));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bd"));
                                                    }
                                                }
                                                else
                                                {
                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14be"));
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TRIGGER_UPDATE_TO_JUNCTION: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TRIGGER_UPDATE_TO_JUNCTION");
                                            }
                                            break;
                                        case "TRIGGER_UPDATE_FROM_JUNCTION":
                                            try
                                            {

                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "TRIGGER_UPDATE_FROM_JUNCTION");
                                                IRowChanges pRowCh = null;

                                                pRowCh = inObject as IRowChanges;

                                                if (pRowCh.get_ValueChanged(intFldIdxs[0]) == true)
                                                {

                                                    if (valData == null)
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ba"));
                                                        break;
                                                    }
                                                    if (inFeature != null)
                                                    {

                                                        netFeat = inFeature as INetworkFeature;
                                                        if (netFeat != null)
                                                        {
                                                            if (inFeature.FeatureType == esriFeatureType.esriFTComplexEdge || inFeature.FeatureType == esriFeatureType.esriFTSimpleEdge)
                                                            {

                                                                string netField = "";
                                                                string netRestrictFC = "";
                                                                string netRestrictField = "";
                                                                string netRestrictValue = "";
                                                                args = valData.Split('|');
                                                                switch (args.GetLength(0))
                                                                {
                                                                    case 1:
                                                                        netField = args[0].ToString().Trim();
                                                                        break;
                                                                    case 2:
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        break;
                                                                    case 3:
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        break;
                                                                    case 4:
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        netRestrictValue = args[3].ToString().Trim();
                                                                        break;
                                                                    default: break;
                                                                }

                                                                iEdgeFeat = (IEdgeFeature)netFeat;
                                                                iJuncFeat = iEdgeFeat.FromJunctionFeature;

                                                                if (netRestrictFC != "")
                                                                {
                                                                    string strClsName = Globals.getClassName(((IDataset)((IFeature)iJuncFeat).Class));

                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bf") + strClsName);
                                                                    if (strClsName != netRestrictFC)
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bg"));
                                                                        break;
                                                                    }
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bh"));
                                                                    if (netRestrictField != "" && netRestrictValue != "")
                                                                    {
                                                                        int intTmpFld = Globals.GetFieldIndex(((IFeature)iJuncFeat).Fields, netRestrictField);

                                                                        if (intTmpFld > -1)
                                                                        {
                                                                            if (((IFeature)iJuncFeat).get_Value(intTmpFld).ToString() == netRestrictValue)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bl"));
                                                                                break;

                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine("                  " + netRestrictField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bm"));
                                                                    }
                                                                }
                                                                if (netField == "CREATE")
                                                                {
                                                                    if (NewFeatureList == null)
                                                                    {
                                                                        NewFeatureList = new List<IObject>();
                                                                    }

                                                                    NewFeatureList.Add(((IFeature)iJuncFeat));
                                                                }
                                                                else if (netField == "CHANGEGEO")
                                                                {
                                                                    if (ChangeFeatureGeoList == null)
                                                                    {
                                                                        ChangeFeatureGeoList = new List<IObject>();
                                                                    }

                                                                    ChangeFeatureGeoList.Add(((IFeature)iJuncFeat));
                                                                }
                                                                else
                                                                {
                                                                    if (ChangeFeatureList == null)
                                                                    {
                                                                        ChangeFeatureList = new List<IObject>();
                                                                    }

                                                                    ChangeFeatureList.Add(((IFeature)iJuncFeat));
                                                                }
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bc"));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bd"));
                                                    }

                                                }
                                                else
                                                {
                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14be"));
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TRIGGER_UPDATE_FROM_JUNCTION: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TRIGGER_UPDATE_FROM_JUNCTION");
                                            }
                                            break;
                                        case "TRIGGER_UPDATE_FROM_EDGE":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "TRIGGER_UPDATE_FROM_EDGE");
                                                if (inFeature != null)
                                                {
                                                    IRowChanges pRowCh = null;

                                                    pRowCh = inObject as IRowChanges;

                                                    if (pRowCh.get_ValueChanged(intFldIdxs[0]) == true)
                                                    {

                                                        if (valData == null)
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ba"));
                                                            break;
                                                        }
                                                        netFeat = inFeature as INetworkFeature;
                                                        if (netFeat != null)
                                                        {
                                                            if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                                            {
                                                                string netField = "";
                                                                string netRestrictFC = "";
                                                                string netRestrictField = "";
                                                                string netRestrictValue = "";
                                                                args = valData.Split('|');
                                                                switch (args.GetLength(0))
                                                                {
                                                                    case 1:  // sequenceColumnName only
                                                                        netField = args[0].ToString().Trim();
                                                                        break;
                                                                    case 2:  // sequenceColumnName|sequenceFixedWidth
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        break;
                                                                    case 3:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        break;
                                                                    case 4:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        netRestrictValue = args[3].ToString().Trim();
                                                                        break;
                                                                    default: break;
                                                                }

                                                                iJuncFeat = (IJunctionFeature)netFeat;
                                                                // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                                                ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                                                if (iSJunc == null)
                                                                    break;
                                                                if (iSJunc.EdgeFeatureCount <= 0)
                                                                    break;
                                                                if (iSJunc.EdgeFeatureCount > 0)
                                                                {
                                                                    for (int i = 0; i < iSJunc.EdgeFeatureCount; i++)
                                                                    {
                                                                        iEdgeFeat = iSJunc.get_EdgeFeature(i);
                                                                        try
                                                                        {
                                                                            if (netRestrictFC != "")
                                                                            {
                                                                                string strClsName = Globals.getClassName(((IDataset)((IFeature)iEdgeFeat).Class));

                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bf") + strClsName);
                                                                                if (strClsName != netRestrictFC)
                                                                                {
                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bg"));
                                                                                    continue;
                                                                                }
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bh"));
                                                                                if (netRestrictField != "" && netRestrictValue != "")
                                                                                {
                                                                                    int intTmpFld = Globals.GetFieldIndex(((IFeature)iEdgeFeat).Fields, netRestrictField);

                                                                                    if (intTmpFld > -1)
                                                                                    {
                                                                                        //IFeature pTest = ((IFeature)iEdgeFeat);

                                                                                        if (((IFeature)iEdgeFeat).get_Value(intTmpFld).ToString() == netRestrictValue)
                                                                                        {
                                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bl"));
                                                                                            continue;

                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        AAState.WriteLine("                  " + netRestrictField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bm"));
                                                                                }
                                                                            }

                                                                            iJuncFeat = iEdgeFeat.ToJunctionFeature;
                                                                            if (((IFeature)iJuncFeat).Shape.Equals(inFeature.Shape))
                                                                            {

                                                                                if (netField == "CREATE")
                                                                                {
                                                                                    if (NewFeatureList == null)
                                                                                    {
                                                                                        NewFeatureList = new List<IObject>();
                                                                                    }

                                                                                    NewFeatureList.Add(((IFeature)iEdgeFeat));
                                                                                }
                                                                                else if (netField == "CHANGEGEO")
                                                                                {
                                                                                    if (ChangeFeatureGeoList == null)
                                                                                    {
                                                                                        ChangeFeatureGeoList = new List<IObject>();
                                                                                    }

                                                                                    ChangeFeatureGeoList.Add(((IFeature)iEdgeFeat));
                                                                                }
                                                                                else
                                                                                {
                                                                                    if (ChangeFeatureList == null)
                                                                                    {
                                                                                        ChangeFeatureList = new List<IObject>();
                                                                                    }

                                                                                    ChangeFeatureList.Add(((IFeature)iEdgeFeat));
                                                                                }

                                                                                break;

                                                                            }
                                                                        }
                                                                        catch
                                                                        {
                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14an"));
                                                                        }

                                                                    }

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bi"));
                                                                }
                                                                iSJunc = null;
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bj"));
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bk"));
                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14be"));
                                                    }

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TRIGGER_UPDATE_FROM_EDGE: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TRIGGER_UPDATE_FROM_EDGE");
                                            }
                                            break;
                                        case "TRIGGER_UPDATE_TO_EDGE":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "TRIGGER_UPDATE_TO_EDGE");
                                                if (inFeature != null)
                                                {
                                                    IRowChanges pRowCh = null;

                                                    pRowCh = inObject as IRowChanges;

                                                    if (pRowCh.get_ValueChanged(intFldIdxs[0]) == true)
                                                    {

                                                        if (valData == null)
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ba"));
                                                            break;
                                                        }
                                                        netFeat = inFeature as INetworkFeature;
                                                        if (netFeat != null)
                                                        {
                                                            if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                                            {
                                                                string netField = "";
                                                                string netRestrictFC = "";
                                                                string netRestrictField = "";
                                                                string netRestrictValue = "";
                                                                args = valData.Split('|');
                                                                switch (args.GetLength(0))
                                                                {
                                                                    case 1:  // sequenceColumnName only
                                                                        netField = args[0].ToString().Trim();
                                                                        break;
                                                                    case 2:  // sequenceColumnName|sequenceFixedWidth
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        break;
                                                                    case 3:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        break;
                                                                    case 4:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                                        netField = args[0].ToString().Trim();
                                                                        netRestrictFC = args[1].ToString().Trim();
                                                                        netRestrictField = args[2].ToString().Trim();
                                                                        netRestrictValue = args[3].ToString().Trim();
                                                                        break;
                                                                    default: break;
                                                                }

                                                                iJuncFeat = (IJunctionFeature)netFeat;
                                                                // IComplexJunctionFeature iCEd = iJuncFeat as IComplexJunctionFeature;
                                                                ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                                                if (iSJunc == null)
                                                                    break;
                                                                if (iSJunc.EdgeFeatureCount <= 0)
                                                                    break;
                                                                if (iSJunc.EdgeFeatureCount > 0)
                                                                {
                                                                    for (int i = 0; i < iSJunc.EdgeFeatureCount; i++)
                                                                    {
                                                                        iEdgeFeat = iSJunc.get_EdgeFeature(i);
                                                                        try
                                                                        {

                                                                            if (netRestrictFC != "")
                                                                            {
                                                                                string strClsName = Globals.getClassName(((IDataset)((IFeature)iEdgeFeat).Class));

                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bf") + strClsName);
                                                                                if (strClsName != netRestrictFC)
                                                                                {
                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bg"));
                                                                                    continue;
                                                                                }
                                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bh"));
                                                                                if (netRestrictField != "" && netRestrictValue != "")
                                                                                {
                                                                                    int intTmpFld = Globals.GetFieldIndex(((IFeature)iEdgeFeat).Fields, netRestrictField);

                                                                                    if (intTmpFld > -1)
                                                                                    {
                                                                                        //IFeature pTest = ((IFeature)iEdgeFeat);

                                                                                        if (((IFeature)iEdgeFeat).get_Value(intTmpFld).ToString() == netRestrictValue)
                                                                                        {
                                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bl"));
                                                                                            continue;

                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        AAState.WriteLine("                  " + netRestrictField + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bm"));
                                                                                }
                                                                            }

                                                                            iJuncFeat = (IJunctionFeature)iEdgeFeat.FromJunctionFeature;
                                                                            if (((IFeature)iJuncFeat).Shape.Equals(inFeature.Shape))
                                                                            {
                                                                                if (netField == "CREATE")
                                                                                {
                                                                                    if (NewFeatureList == null)
                                                                                    {
                                                                                        NewFeatureList = new List<IObject>();
                                                                                    }

                                                                                    NewFeatureList.Add(((IFeature)iEdgeFeat));
                                                                                }
                                                                                else if (netField == "CHANGEGEO")
                                                                                {
                                                                                    if (ChangeFeatureGeoList == null)
                                                                                    {
                                                                                        ChangeFeatureGeoList = new List<IObject>();
                                                                                    }

                                                                                    ChangeFeatureGeoList.Add(((IFeature)iEdgeFeat));
                                                                                }
                                                                                else
                                                                                {
                                                                                    if (ChangeFeatureList == null)
                                                                                    {
                                                                                        ChangeFeatureList = new List<IObject>();
                                                                                    }

                                                                                    ChangeFeatureList.Add(((IFeature)iEdgeFeat));
                                                                                }

                                                                                break;
                                                                                break;

                                                                            }
                                                                        }
                                                                        catch
                                                                        {
                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14an"));
                                                                        }

                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bi"));
                                                                }
                                                                iSJunc = null;
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bj"));
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bk"));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14be"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "TRIGGER_UPDATE_TO_EDGE: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "TRIGGER_UPDATE_TO_EDGE");
                                            }
                                            break;
                                        //***********8
                                        //Release: 1.2
                                        //New Dynamic Value Method: GENERATE_ID - uses value in specificed table and increments it as specified
                                        case "GENERATE_ID":

                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "GENERATE_ID");
                                                if (AAState._gentab != null)
                                                {
                                                    sequenceColumnName = "";
                                                    sequenceColumnNum = -1;
                                                    sequenceValue = -1;
                                                    sequenceFixedWidth = "";
                                                    sequencePadding = 0;
                                                    formatString = "";

                                                    // Parse arguments
                                                    if (valData == null) break;
                                                    args = valData.Split('|');
                                                    switch (args.GetLength(0))
                                                    {
                                                        case 1:  // sequenceColumnName only
                                                            sequenceColumnName = args[0].ToString(); break;
                                                        case 2:  // sequenceColumnName|sequenceFixedWidth
                                                            sequenceColumnName = args[0].ToString();
                                                            sequenceFixedWidth = args[1].ToString();
                                                            break;
                                                        case 3:  // sequenceColumnName|sequenceFixedWidth|formatString
                                                            sequenceColumnName = args[0].ToString();
                                                            sequenceFixedWidth = args[1].ToString();
                                                            formatString = args[2].ToString();
                                                            break;
                                                        default: break;
                                                    }

                                                    //Check for requested zero padding of sequence number
                                                    if (sequenceFixedWidth != "")
                                                        int.TryParse(sequenceFixedWidth.ToString(), out sequencePadding);
                                                    if (sequencePadding > 25)
                                                    {

                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain116"));
                                                        AAState.WriteLine("                  WARNING: " + sequencePadding + " 0's is what you have");

                                                    }
                                                    else if (sequencePadding > 50)
                                                    {
                                                        MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain117"));
                                                    }
                                                    qFilter = new QueryFilterClass();
                                                    qFilter.WhereClause = "SEQNAME = '" + sequenceColumnName + "'";
                                                    cCurs = AAState._gentab.Update(qFilter, false);
                                                    sequenceColumnNum = AAState._gentab.Fields.FindField("SEQCOUNTER");
                                                    //get value of first row, increment it, and return incremented value
                                                    for (int j = 0; j < 51; j++)
                                                    {
                                                        row = cCurs.NextRow();
                                                        if (row == null)
                                                        {
                                                            break;
                                                        }
                                                        if (row.get_Value(sequenceColumnNum) == null)
                                                        {
                                                            sequenceValue = 0;
                                                        }
                                                        else if (row.get_Value(sequenceColumnNum).ToString() == "")
                                                        {
                                                            sequenceValue = 0;
                                                        }
                                                        else
                                                            sequenceValue = Convert.ToInt32(row.get_Value(sequenceColumnNum));

                                                        // _editEvents.OnChangeFeature -= OnChangeFeature;
                                                        // _editEvents.OnCreateFeature -= OnCreateFeature;
                                                        int sequenceInt = 1;

                                                        if (AAState._gentab.Fields.FindField("SEQINTERV") > 0)
                                                        {
                                                            if (row.get_Value(AAState._gentab.Fields.FindField("SEQINTERV")) != null)
                                                            {
                                                                if (row.get_Value(AAState._gentab.Fields.FindField("SEQINTERV")) != DBNull.Value)
                                                                    sequenceInt = Convert.ToInt32(row.get_Value(AAState._gentab.Fields.FindField("SEQINTERV")));
                                                            }
                                                        }
                                                        sequenceValue = sequenceValue + sequenceInt;

                                                        row.set_Value(sequenceColumnNum, sequenceValue);
                                                        AAState.WriteLine("                  " + row.Fields.get_Field(sequenceColumnNum).AliasName + " changed to " + sequenceValue);
                                                        //AAState.changeFeature -= OnChangeFeature;
                                                        //AAState.createFeature -= OnCreateFeature;

                                                        row.Store();
                                                        //AAState.changeFeature += OnChangeFeature;
                                                        //AAState.createFeature += OnCreateFeature;

                                                        //  _editEvents.OnChangeFeature += OnChangeFeature;
                                                        //  _editEvents.OnCreateFeature += OnCreateFeature;
                                                        if (Convert.ToInt32(row.get_Value(sequenceColumnNum)) == sequenceValue)
                                                            break;

                                                    }
                                                    if (sequenceValue == -1)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "GENERATE_ID: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ao"));
                                                    }

                                                    else
                                                    {
                                                        if (inObject.Fields.get_Field(intFldIdxs[0]).Type == esriFieldType.esriFieldTypeString)
                                                            if (formatString == null || formatString == "" || formatString.ToLower().IndexOf("[seq]") == -1)
                                                            {
                                                                string setVal = (sequenceValue.ToString("D" + sequencePadding) + sequencePostfix).ToString();

                                                                if (inObject.Fields.get_Field(intFldIdxs[0]).Length < setVal.Length && inObject.Fields.get_Field(intFldIdxs[0]).Length != 0)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + sequenceValue + " is to long for field " + row.Fields.get_Field(sequenceColumnNum).AliasName);
                                                                }
                                                                else
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], (sequenceValue.ToString("D" + sequencePadding) + sequencePostfix).Trim());
                                                                    AAState.WriteLine("                  " + inObject.Fields.get_Field(intFldIdxs[0]).AliasName + " set to " + sequenceValue.ToString("D" + sequencePadding) + sequencePostfix);

                                                                }

                                                            }
                                                            else
                                                            {

                                                                int locIdx = formatString.ToUpper().IndexOf("[SEQ]");
                                                                if (locIdx >= 0)
                                                                {
                                                                    formatString = formatString.Remove(locIdx, 5);
                                                                    formatString = formatString.Insert(locIdx, sequenceValue.ToString("D" + sequencePadding));
                                                                }
                                                                //formatString = formatString.Replace("[seq]", sequenceValue.ToString("D" + sequencePadding));

                                                                if (inObject.Fields.get_Field(intFldIdxs[0]).Length < formatString.Length && inObject.Fields.get_Field(intFldIdxs[0]).Length != 0)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + formatString + " is to long for field " + row.Fields.get_Field(sequenceColumnNum).AliasName);
                                                                }
                                                                else
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], formatString.Trim());
                                                                    AAState.WriteLine("                  " + inObject.Fields.get_Field(intFldIdxs[0]).AliasName + " set to " + formatString);
                                                                }

                                                            }
                                                        else
                                                        {

                                                            inObject.set_Value(intFldIdxs[0], sequenceValue);
                                                            AAState.WriteLine("                  " + sequenceColumnNum + " changed to " + sequenceValue);
                                                        }
                                                    }

                                                }
                                                else
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "GENERATE_ID: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ap"));

                                                }

                                            }

                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "GENERATE_ID: " + ex.Message);
                                            }
                                            finally
                                            {
                                                if (cCurs != null)
                                                {
                                                    Marshal.ReleaseComObject(cCurs);
                                                    GC.Collect(300);
                                                    GC.WaitForFullGCComplete();
                                                    cCurs = null;

                                                }
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "GENERATE_ID");
                                            }
                                            break;

                                        case "GENERATE_ID_BY_INTERSECT":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "GENERATE_ID_BY_INTERSECT");
                                                if (AAState._gentab != null && inFeature != null && !(inFeature.Shape.IsEmpty))
                                                {
                                                    sequenceColumnName = "";
                                                    sequenceColumnNum = -1;
                                                    sequenceValue = -1;
                                                    sequenceFixedWidth = "";
                                                    sequencePadding = 0;
                                                    //genIdAreaFieldName = "";
                                                    intersectLayerName = "";
                                                    intersectLayerFieldName = "";
                                                    formatString = "";
                                                    intersectFieldPos = -1;

                                                    // Parse arguments
                                                    if (valData == null) break;

                                                    args = valData.Split('|');
                                                    if (args.GetLength(0) < 3)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "GENERATE_ID: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ap"));
                                                        break;
                                                    }
                                                    switch (args.GetLength(0))
                                                    {
                                                        case 3:  //columnName
                                                            intersectLayerName = args[0].ToString();
                                                            intersectLayerFieldName = args[1].ToString();
                                                            // genIdAreaFieldName = args[2].ToString();
                                                            sequenceColumnName = args[2].ToString();
                                                            break;
                                                        case 4:  // columnName|sequenceFixedWidth
                                                            //sequenceFixedWidth formats the sequence with leading zeros to create specified width
                                                            intersectLayerName = args[0].ToString();
                                                            intersectLayerFieldName = args[1].ToString();
                                                            //genIdAreaFieldName = args[2].ToString();
                                                            sequenceColumnName = args[2].ToString();
                                                            sequenceFixedWidth = Convert.ToString(0);
                                                            formatString = args[3].ToString();

                                                            break;
                                                        case 5:  // columnName|sequenceFixedWidth|formatString
                                                            //formatString must contain [seq] and [id]  and may contain [area] plus any desired text
                                                            intersectLayerName = args[0].ToString();
                                                            intersectLayerFieldName = args[1].ToString();
                                                            //genIdAreaFieldName = args[2].ToString();
                                                            sequenceColumnName = args[2].ToString();
                                                            sequenceFixedWidth = args[3].ToString();
                                                            formatString = args[4].ToString();
                                                            break;
                                                        default: break;
                                                    }

                                                    //Find Area Layer
                                                    // FindLayerByName(areaLayerName, out areaLayer);

                                                    boolLayerOrFC = true;
                                                    if (intersectLayerName.Contains("("))
                                                    {
                                                        string[] tempSplt = intersectLayerName.Split('(');
                                                        intersectLayerName = tempSplt[0];
                                                        intersectLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, intersectLayerName, ref boolLayerOrFC);
                                                        if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                        {
                                                            boolLayerOrFC = true;
                                                        }
                                                        else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                        {
                                                            boolLayerOrFC = true;
                                                        }
                                                        else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                        {
                                                            boolLayerOrFC = false;
                                                        }
                                                        else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                        {
                                                            boolLayerOrFC = false;
                                                        }
                                                        else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                        {
                                                            boolLayerOrFC = false;
                                                        }
                                                        else
                                                        {
                                                            boolLayerOrFC = true;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        intersectLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, intersectLayerName, ref boolLayerOrFC);

                                                    }
                                                    if (intersectLayer == null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aq") +"(" + intersectLayerName + ") not found");
                                                        break;
                                                    }
                                                    //Find Area Field
                                                    intersectFieldPos = intersectLayer.FeatureClass.FindField(intersectLayerFieldName);
                                                    if (intersectFieldPos < 0)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14as") +"(" + intersectLayerFieldName + ") not found");
                                                        break;
                                                    }

                                                    //Perform spatial search
                                                    IGeometry pSearchGeo = Globals.GetGeomCenter((IGeometry)inFeature.ShapeCopy)[0];
                                                    pSearchGeo.SpatialReference = (inFeature.Class as IGeoDataset).SpatialReference;
                                                    pSearchGeo.Project((intersectLayer as IGeoDataset).SpatialReference);

                                                    sFilter = Globals.createSpatialFilter(intersectLayer, inFeature, false);

                                                    pFS = (IFeatureSelection)intersectLayer;
                                                    if (boolLayerOrFC)
                                                    {
                                                        if (pFS.SelectionSet.Count > 0)
                                                        {
                                                            pFS.SelectionSet.Search(sFilter, true, out cCurs);
                                                            fCursor = cCurs as IFeatureCursor;

                                                        }
                                                        else
                                                        {
                                                            fCursor = intersectLayer.Search(sFilter, true);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        fCursor = intersectLayer.FeatureClass.Search(sFilter, true);
                                                    }

                                                    sourceFeature = fCursor.NextFeature();
                                                    intersectValue = "-9999.1";
                                                    if (sourceFeature == null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14at"));
                                                        break;
                                                    }
                                                    else
                                                    {
                                                        while (sourceFeature != null)
                                                        {
                                                            if (sourceFeature.Class != inFeature.Class)
                                                            {
                                                                intersectValue = sourceFeature.get_Value(intersectFieldPos).ToString();
                                                                break;
                                                            }
                                                            else if (sourceFeature.Class == inFeature.Class && sourceFeature.OID != inFeature.OID)
                                                            {
                                                                intersectValue = sourceFeature.get_Value(intersectFieldPos).ToString();
                                                                break;
                                                            }
                                                            sourceFeature = fCursor.NextFeature();
                                                        }
                                                    }
                                                    if (intersectValue == "-9999.1")
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14at"));
                                                        break;
                                                    }
                                                    //Check for requested zero padding of sequence number
                                                    if (sequenceFixedWidth != "")
                                                        int.TryParse(sequenceFixedWidth.ToString(), out sequencePadding);

                                                    if (sequencePadding > 25)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain116"));
                                                        AAState.WriteLine("                  WARNING: " + sequencePadding + " 0's is what you have");

                                                    }
                                                    sequenceColumnName = sequenceColumnName + intersectValue;
                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bn") + sequenceColumnName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bo"));

                                                    qFilter = new QueryFilterClass();
                                                    qFilter.WhereClause = "SEQNAME = '" + sequenceColumnName + "'";
                                                    cCurs = AAState._gentab.Update(qFilter, false);
                                                    sequenceColumnNum = AAState._gentab.Fields.FindField("SEQCOUNTER");

                                                    //get value of first row, increment it, and return incremented value
                                                    for (int j = 0; j < 51; j++)
                                                    {
                                                        row = cCurs.NextRow();
                                                        if (row == null)
                                                        {
                                                            break;
                                                        }
                                                        if (row.get_Value(sequenceColumnNum) == null)
                                                        {
                                                            sequenceValue = 0;
                                                        }
                                                        else if (row.get_Value(sequenceColumnNum).ToString() == "")
                                                        {
                                                            sequenceValue = 0;
                                                        }
                                                        else
                                                            sequenceValue = Convert.ToInt32(row.get_Value(sequenceColumnNum));

                                                        int sequenceInt = 1;

                                                        if (AAState._gentab.Fields.FindField("SEQINTERV") > 0)
                                                        {
                                                            if (row.get_Value(AAState._gentab.Fields.FindField("SEQINTERV")) != null)
                                                            {
                                                                if (row.get_Value(AAState._gentab.Fields.FindField("SEQINTERV")) != DBNull.Value)
                                                                    sequenceInt = Convert.ToInt32(row.get_Value(AAState._gentab.Fields.FindField("SEQINTERV")));
                                                            }
                                                        }
                                                        sequenceValue = sequenceValue + sequenceInt;

                                                        row.set_Value(sequenceColumnNum, sequenceValue);

                                                        row.Store();

                                                        if (Convert.ToInt32(row.get_Value(sequenceColumnNum)) == sequenceValue)
                                                            break;

                                                    }
                                                    if (sequenceValue == -1)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14au"));
                                                    }
                                                    else
                                                    {
                                                        if (inObject.Fields.get_Field(intFldIdxs[0]).Type == esriFieldType.esriFieldTypeString)
                                                            if (formatString == null || formatString == "" || (formatString.ToUpper().IndexOf("[SEQ]") == -1 && formatString.ToUpper().IndexOf("[ID]") == -1))
                                                                inObject.set_Value(intFldIdxs[0], intersectValue + sequenceValue.ToString("D" + sequencePadding) + sequencePostfix);
                                                            else
                                                            {

                                                                int locIdx = formatString.ToUpper().IndexOf("[ID]");
                                                                if (locIdx >= 0)
                                                                {
                                                                    formatString = formatString.Remove(locIdx, 4);
                                                                    formatString = formatString.Insert(locIdx, intersectValue);
                                                                }

                                                                locIdx = formatString.ToUpper().IndexOf("[SEQ]");
                                                                if (locIdx >= 0)
                                                                {
                                                                    string sequenceValuePad = sequenceValue.ToString("D" + sequencePadding);
                                                                    formatString = formatString.Remove(locIdx, 5);
                                                                    formatString = formatString.Insert(locIdx, sequenceValuePad.ToString());
                                                                }
                                                                //
                                                                inObject.set_Value(intFldIdxs[0], formatString);
                                                            }
                                                        else
                                                            inObject.set_Value(intFldIdxs[0], sequenceValue);
                                                    }

                                                }
                                                else
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "GENERATE_ID: " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ap"));

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "GENERATE_ID_BY_INTERSECT: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "GENERATE_ID_BY_INTERSECT");
                                            }
                                            break;

                                        //Modified for Release 1.2  (No longer uses ICalculator)
                                        //Requires valid VBScript expression
                                        //Can include string, numeric, and date fields by name in square brackets []
                                        //Example: DateDiff("yyyy",[INSTALLDATE],Now())
                                        case "EXPRESSION":
                                            try
                                            {

                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "EXPRESSION");
                                                if (inObject != null & valData != null)
                                                {
                                                    int intTargetFld = -1;
                                                    if (intFldIdxs.Count == 0)
                                                    {

                                                    }
                                                    else
                                                    {
                                                        intTargetFld = intFldIdxs[0];
                                                    }

                                                    newValue = valData;
                                                    for (int i = 0; i <= inObject.Fields.FieldCount; i++)
                                                    {

                                                        string strTmpFldName;
                                                        int intTmpIdx;
                                                        if (i == inObject.Fields.FieldCount)
                                                        {
                                                            testField = inObject.Fields.get_Field(intFldIdxs[0]);
                                                            strTmpFldName = "#";
                                                            intTmpIdx = intFldIdxs[0];
                                                        }
                                                        else
                                                        {
                                                            testField = inObject.Fields.get_Field(i);
                                                            strTmpFldName = testField.Name;
                                                            intTmpIdx = i;
                                                        }

                                                        int indFld = newValue.ToUpper().IndexOf("[" + strTmpFldName.ToUpper() + "]");
                                                        while (indFld >= 0)
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bp") + testField.Name + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bq"));
                                                            int fldLen = strTmpFldName.Length;
                                                            string tmpStr1 = newValue.Substring(0, indFld + 1);
                                                            string tmpStr2 = newValue.Substring(indFld + fldLen + 1);
                                                            newValue = tmpStr1 + "_REPLACE_VAL_" + tmpStr2;

                                                            switch (testField.Type)
                                                            {
                                                                case esriFieldType.esriFieldTypeString:

                                                                    if (inObject.get_Value(intTmpIdx) == null || inObject.get_Value(intTmpIdx).ToString() == "")
                                                                    {
                                                                        if (newValue.Contains("IsNull"))
                                                                        {
                                                                            newValue = newValue.Replace("IsNull([" + "_REPLACE_VAL_" + "])", "True");
                                                                        }
                                                                        else if (newValue.Contains("isNull"))
                                                                        {
                                                                            newValue = newValue.Replace("isNull([" + "_REPLACE_VAL_" + "])", "True");
                                                                        }
                                                                        else if (newValue.Contains("ISNULL"))
                                                                        {
                                                                            newValue = newValue.Replace("ISNULL([" + "_REPLACE_VAL_" + "])", "True");
                                                                        }
                                                                        else if (inObject.get_Value(intTmpIdx) == null)
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + "\"");
                                                                        }
                                                                        else if (inObject.get_Value(intTmpIdx) == DBNull.Value)
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + "\"");
                                                                        }
                                                                        else if (inObject.get_Value(intTmpIdx).ToString() == "")
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + inObject.get_Value(intTmpIdx).ToString() + "\"");
                                                                        }
                                                                        else
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + inObject.get_Value(intTmpIdx).ToString() + "\"");
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        if (newValue.Contains("IsNull"))
                                                                        {
                                                                            newValue = newValue.Replace("IsNull([" + "_REPLACE_VAL_" + "])", "False");
                                                                        }

                                                                        else
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + inObject.get_Value(intTmpIdx).ToString() + "\"");
                                                                        }
                                                                    }

                                                                    break;
                                                                case esriFieldType.esriFieldTypeDate:

                                                                    if (inObject.get_Value(intTmpIdx) == null || inObject.get_Value(intTmpIdx).ToString() == "" || inObject.get_Value(intTmpIdx) == DBNull.Value)
                                                                    {
                                                                        if (newValue.Contains("IsNull([" + "_REPLACE_VAL_" + "])"))
                                                                        {
                                                                            newValue = newValue.Replace("IsNull([" + "_REPLACE_VAL_" + "])", "True");
                                                                        }
                                                                        else if (newValue.Contains("isNull([" + "_REPLACE_VAL_" + "])"))
                                                                        {
                                                                            newValue = newValue.Replace("isNull([" + "_REPLACE_VAL_" + "])", "True");
                                                                        }
                                                                        else if (newValue.Contains("ISNULL([" + "_REPLACE_VAL_" + "])"))
                                                                        {
                                                                            newValue = newValue.Replace("ISNULL([" + "_REPLACE_VAL_" + "])", "True");
                                                                        }
                                                                        else if (inObject.get_Value(intTmpIdx) == null)
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + inObject.get_Value(intTmpIdx).ToString() + "\"");
                                                                        }
                                                                        else if (inObject.get_Value(intTmpIdx) == DBNull.Value)
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + "\"");//"\"" + inObject.get_Value(intTmpIdx).ToString() + "\"");
                                                                        }
                                                                        else if (inObject.get_Value(intTmpIdx).ToString() == "")
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + inObject.get_Value(intTmpIdx).ToString() + "\"");
                                                                        }
                                                                        else
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "CDATE(\"" + inObject.get_Value(intTmpIdx).ToString() + "\")");
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        if (newValue.Contains("IsNull"))
                                                                        {
                                                                            newValue = newValue.Replace("IsNull([" + "_REPLACE_VAL_" + "])", "False");
                                                                        }

                                                                        else
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "CDATE(\"" + inObject.get_Value(intTmpIdx).ToString() + "\")");
                                                                        }
                                                                    }

                                                                    break;
                                                                case esriFieldType.esriFieldTypeDouble:

                                                                    if (inObject.get_Value(intTmpIdx) == null || inObject.get_Value(intTmpIdx).ToString() == "")
                                                                    {
                                                                        if (newValue.Contains("IsNull"))
                                                                        {
                                                                            newValue = newValue.Replace("IsNull([" + "_REPLACE_VAL_" + "])", "True");
                                                                        }
                                                                        else if (newValue.Contains("isNull"))
                                                                        {
                                                                            newValue = newValue.Replace("isNull([" + "_REPLACE_VAL_" + "])", "True");
                                                                        }
                                                                        else if (newValue.Contains("ISNULL"))
                                                                        {
                                                                            newValue = newValue.Replace("ISNULL([" + "_REPLACE_VAL_" + "])", "True");
                                                                        }
                                                                        else if (inObject.get_Value(intTmpIdx) == null)
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + "\"");
                                                                        }
                                                                        else if (inObject.get_Value(intTmpIdx) == DBNull.Value)
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + "\"");
                                                                        }
                                                                        else if (inObject.get_Value(intTmpIdx).ToString() == "")
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + "\"");
                                                                        }
                                                                        else
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "" + inObject.get_Value(intTmpIdx).ToString() + "");
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        if (newValue.Contains("IsNull"))
                                                                        {
                                                                            newValue = newValue.Replace("IsNull([" + "_REPLACE_VAL_" + "])", "False");
                                                                        }

                                                                        else
                                                                        {

                                                                            double val;
                                                                            Double.TryParse(inObject.get_Value(intTmpIdx).ToString(), out val);

                                                                            // '  string test2 = test.ToString("N",nfi);
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", val.ToString("N", nfi));
                                                                        }
                                                                    }

                                                                    break;

                                                                default:
                                                                    if (inObject.get_Value(intTmpIdx) == null || inObject.get_Value(intTmpIdx).ToString() == "")
                                                                    {
                                                                        if (newValue.Contains("IsNull"))
                                                                        {
                                                                            newValue = newValue.Replace("IsNull([" + "_REPLACE_VAL_" + "])", "True");
                                                                        }
                                                                        else if (newValue.Contains("isNull"))
                                                                        {
                                                                            newValue = newValue.Replace("isNull([" + "_REPLACE_VAL_" + "])", "True");
                                                                        }
                                                                        else if (newValue.Contains("ISNULL"))
                                                                        {
                                                                            newValue = newValue.Replace("ISNULL([" + "_REPLACE_VAL_" + "])", "True");
                                                                        }
                                                                        else if (inObject.get_Value(intTmpIdx) == null)
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + "\"");
                                                                        }
                                                                        else if (inObject.get_Value(intTmpIdx) == DBNull.Value)
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + "\"");
                                                                        }
                                                                        else if (inObject.get_Value(intTmpIdx).ToString() == "")
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "\"" + "\"");
                                                                        }
                                                                        else
                                                                        {
                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", "" + inObject.get_Value(intTmpIdx).ToString() + "");
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        if (newValue.Contains("IsNull"))
                                                                        {
                                                                            newValue = newValue.Replace("IsNull([" + "_REPLACE_VAL_" + "])", "False");
                                                                        }

                                                                        else
                                                                        {

                                                                            newValue = newValue.Replace("[" + "_REPLACE_VAL_" + "]", inObject.get_Value(intTmpIdx).ToString());
                                                                        }
                                                                    }

                                                                    break;
                                                            }
                                                            indFld = newValue.ToUpper().IndexOf("[" + testField.Name.ToUpper() + "]");
                                                        }
                                                    }

                                                    try
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain118"));
                                                        if (intTargetFld > -1)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14br") + newValue);

                                                            newValue = script.Eval(newValue).ToString();
                                                            if (newValue.ToUpper() == "<Null>".ToUpper())
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain119"));
                                                                inObject.set_Value(intTargetFld, DBNull.Value);
                                                            }
                                                            else if (inObject.get_Value(intTargetFld).ToString() != newValue)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain120") + newValue.Trim());
                                                                inObject.set_Value(intTargetFld, newValue.Trim());
                                                            }
                                                        }
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14av") + inObject.Class.AliasName + " with OID of " + inObject.OID);
                                                        AAState.WriteLine("                         " + ex.Message);
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "EXPRESSION: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "EXPRESSION");
                                            }
                                            break;

                                        // GUID values are calculated into text fields or into native GUID field types
                                        // When using text field you have an optional argument (valdata) to specify the format
                                        // N-none 32 chars, D-dash 36, B-braces 38, P-Parenthesis 38
                                        case "GUID":
                                            try
                                            {
                                                if (inObject != null)
                                                {
                                                    if (inObject.Fields.get_Field(intFldIdxs[0]).Type == esriFieldType.esriFieldTypeGUID)
                                                        inObject.set_Value(intFldIdxs[0], System.Guid.NewGuid().ToString("B"));
                                                    else if (inObject.Fields.get_Field(intFldIdxs[0]).Type == esriFieldType.esriFieldTypeString &&
                                                             inObject.Fields.get_Field(intFldIdxs[0]).Length >= 32)
                                                    {

                                                        valData = valData.Trim();
                                                        if (valData != "N" && valData != "D" && valData != "B" && valData != "P")
                                                            if (inObject.Fields.get_Field(intFldIdxs[0]).Length >= 38)
                                                                valData = "B";  //Default to braces
                                                            else if (inObject.Fields.get_Field(intFldIdxs[0]).Length < 36)
                                                                valData = "N";
                                                            else
                                                                valData = "D";
                                                        inObject.set_Value(intFldIdxs[0], System.Guid.NewGuid().ToString(valData));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "EXPRESSION: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "EXPRESSION");
                                            }
                                            break;

                                        case "CREATE_LINKED_RECORD"://Feature Layer|Field To Copy|Field To Populate|Primary Key Field|Foreign Key Field
                                            {
                                                try
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "CREATE_LINKED_RECORD");
                                                    if (!String.IsNullOrEmpty(valData))
                                                    {
                                                        args = valData.Split('|');
                                                        if (args.Length < 5)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ad"));
                                                            break;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ad"));
                                                        break;
                                                    }
                                                    if (inObject == null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ak"));
                                                        break;
                                                    }
                                                    sourceLayerName = "";
                                                    sourceFieldName = "";
                                                    sourceField = -1;
                                                    found = false;
                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bs"));
                                                    sourceLayerNames = args[0].ToString().Split(',');
                                                    sourceFieldName = args[1].ToString().Trim();
                                                    string targetFieldName = args[2].ToString().Trim();
                                                    string sourceIDFieldName = args[3].ToString().Trim();
                                                    string targetIDFieldName = args[4].ToString().Trim();
                                                    int countFld = 1;
                                                    if (args.Length == 6)
                                                    {

                                                        if (!Globals.IsNumeric(args[5].ToString().Trim()))
                                                        {
                                                            int fldx = Globals.GetFieldIndex(inObject.Fields, args[5].ToString().Trim());

                                                            if (fldx > 0)
                                                            {
                                                                string tempVal = inObject.get_Value(fldx).ToString();
                                                                if (Globals.IsNumeric(tempVal))
                                                                    countFld = Convert.ToInt32(tempVal);

                                                            }

                                                        }
                                                        else
                                                        {
                                                            countFld = Convert.ToInt32(args[5].ToString().Trim());

                                                        }

                                                    }
                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bt"));
                                                    if (sourceFieldName != null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain121"));
                                                        int fldValToCopyIdx = Globals.GetFieldIndex(inObject.Fields, sourceFieldName);
                                                        int fldIDToCopyIdx = Globals.GetFieldIndex(inObject.Fields, sourceIDFieldName);
                                                        if (fldValToCopyIdx > -1 && fldIDToCopyIdx > -1)
                                                        {

                                                            for (int i = 0; i < sourceLayerNames.Length; i++)
                                                            {
                                                                sourceLayerName = sourceLayerNames[i].ToString().Trim();

                                                                if (sourceLayerName != "")
                                                                {

                                                                    // Get layer
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain122"));
                                                                    bool FCorLayerSource = true;
                                                                    sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref FCorLayerSource);

                                                                    if (sourceLayer != null)
                                                                    {
                                                                        AAState.WriteLine("                  " + sourceLayerName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));

                                                                    }
                                                                    else
                                                                    {
                                                                        ITable pTable = Globals.FindTable(AAState._editor.Map, sourceLayerName);
                                                                        if (pTable != null)
                                                                        {
                                                                            int fldValToPopIdx = Globals.GetFieldIndex(pTable.Fields, targetFieldName);
                                                                            int fldIDToPopIdx = Globals.GetFieldIndex(pTable.Fields, targetIDFieldName);
                                                                            if (fldValToPopIdx > -1 && fldIDToPopIdx > -1)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain123"));
                                                                                IRow pNewRow;
                                                                                for (int j = 0; j < countFld; j++)
                                                                                {
                                                                                    pNewRow = pTable.CreateRow();
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain124"));
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain125"));
                                                                                    try
                                                                                    {
                                                                                        pNewRow.set_Value(fldIDToPopIdx, inObject.get_Value(fldIDToCopyIdx));

                                                                                    }
                                                                                    catch
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aw") + inObject.get_Value(fldIDToCopyIdx) + " to field: " + targetIDFieldName);
                                                                                    }
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain126"));
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain127"));
                                                                                    try
                                                                                    {
                                                                                        pNewRow.set_Value(fldValToPopIdx, inObject.get_Value(fldValToCopyIdx));

                                                                                    }
                                                                                    catch
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aw") + inObject.get_Value(fldValToCopyIdx) + " to field: " + targetFieldName);
                                                                                    }
                                                                                    if (NewFeatureList == null)
                                                                                    {
                                                                                        NewFeatureList = new List<IObject>();
                                                                                    }
                                                                                    IObject featobj = pNewRow as IObject;

                                                                                    if (featobj != null)
                                                                                    {
                                                                                        NewFeatureList.Add(featobj);
                                                                                    }

                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain128"));
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14k"));
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ax") + sourceLayerName);
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ay"));
                                                        }

                                                    }

                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "CREATE_LINKED_RECORD" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "CREATE_LINKED_RECORD");

                                                }
                                                break;

                                            }

                                        case "UPDATE_INTERSECTING_FEATURE"://Intersected Feature|FieldIntersectingFeatureToChange|FromFieldinModifiedFeature
                                            {
                                                try
                                                {
                                                    IFeatureCursor fLocalCursor = null;
                                                    IFeature sourceFeatureLocal = null;
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "UPDATE_INTERSECTING_FEATURE");
                                                    if (!String.IsNullOrEmpty(valData))
                                                    {
                                                        args = valData.Split('|');
                                                        if (args.Length != 3)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ad"));
                                                            break;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ad"));
                                                        break;
                                                    }
                                                    if (inFeature == null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ak"));
                                                        break;
                                                    }
                                                    bool cont = true;
                                                    if (intFldIdxs.Count > 1)
                                                    {
                                                        IRowChanges inChanges = inObject as IRowChanges;
                                                        if (inChanges.get_ValueChanged(intFldIdxs[0]))
                                                        {
                                                            cont = true;
                                                        }
                                                        else
                                                        {
                                                            cont = false;
                                                        }

                                                        inChanges = null;

                                                    }
                                                    if (cont)
                                                    {

                                                        sourceLayerName = "";
                                                        sourceFieldName = "";
                                                        sourceField = -1;
                                                        found = false;
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bs"));
                                                        sourceLayerNames = args[0].ToString().Split(',');
                                                        sourceFieldName = args[1].ToString().Trim();
                                                        string targetFieldName = args[2].ToString().Trim();
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bt"));
                                                        if (sourceFieldName != null)
                                                        {
                                                            for (int i = 0; i < sourceLayerNames.Length; i++)
                                                            {
                                                                sourceLayerName = sourceLayerNames[i].ToString().Trim();
                                                                if (sourceLayerName != "")
                                                                {

                                                                    boolLayerOrFC = true;
                                                                    if (sourceLayerName.Contains("("))
                                                                    {
                                                                        string[] tempSplt = sourceLayerName.Split('(');
                                                                        sourceLayerName = tempSplt[0].Trim();
                                                                        sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);
                                                                        if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);
                                                                    }
                                                                    if (sourceLayer != null)
                                                                    {

                                                                        if (Globals.IsEditable(ref sourceLayer, ref AAState._editor))
                                                                        {

                                                                            if (inObject.Class.ObjectClassID != sourceLayer.FeatureClass.ObjectClassID)
                                                                            {
                                                                                sourceField = Globals.GetFieldIndex(sourceLayer.FeatureClass.Fields, sourceFieldName);

                                                                                if (sourceField > -1)
                                                                                {
                                                                                    sFilter = Globals.createSpatialFilter(sourceLayer, inFeature, false);

                                                                                    int fldIdx = Globals.GetFieldIndex(inFeature.Fields, targetFieldName);
                                                                                    AAState.WriteLine("                  " + targetFieldName + " at index " + fldIdx);
                                                                                    string test = targetFieldName;
                                                                                    if (fldIdx > -1)
                                                                                    {
                                                                                        test = inFeature.get_Value(fldIdx).ToString().Trim();
                                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bu") + test);
                                                                                    }
                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bv") + test);

                                                                                    pFS = (IFeatureSelection)sourceLayer;
                                                                                    if (boolLayerOrFC)
                                                                                    {
                                                                                        if (pFS.SelectionSet.Count > 0)
                                                                                        {
                                                                                            pFS.SelectionSet.Search(sFilter, false, out cCurs);
                                                                                            fLocalCursor = cCurs as IFeatureCursor;

                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            fLocalCursor = sourceLayer.Search(sFilter, false);
                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        fLocalCursor = sourceLayer.FeatureClass.Search(sFilter, false);
                                                                                    }

                                                                                    while ((sourceFeatureLocal = fLocalCursor.NextFeature()) != null)
                                                                                    {
                                                                                        try
                                                                                        {
                                                                                            if (sourceFeatureLocal.Class.ObjectClassID != inFeature.Class.ObjectClassID)
                                                                                            {
                                                                                                if (sourceFeatureLocal.Fields.get_Field(sourceField).Type == esriFieldType.esriFieldTypeString)
                                                                                                {
                                                                                                    sourceFeatureLocal.set_Value(sourceField, test);

                                                                                                    if (ChangeFeatureList == null)
                                                                                                    {
                                                                                                        ChangeFeatureList = new List<IObject>();
                                                                                                    }
                                                                                                    ChangeFeatureList.Add(sourceFeatureLocal);
                                                                                                    found = true;

                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    if (Globals.IsNumeric(test))
                                                                                                    {
                                                                                                        if (sourceFeatureLocal.Fields.get_Field(sourceField).Type == esriFieldType.esriFieldTypeSmallInteger ||
                                                                                                            sourceFeatureLocal.Fields.get_Field(sourceField).Type == esriFieldType.esriFieldTypeInteger)
                                                                                                        {

                                                                                                            sourceFeatureLocal.set_Value(sourceField, Convert.ToInt32(test));

                                                                                                            if (ChangeFeatureList == null)
                                                                                                            {
                                                                                                                ChangeFeatureList = new List<IObject>();
                                                                                                            }
                                                                                                            ChangeFeatureList.Add(sourceFeatureLocal);
                                                                                                            found = true;
                                                                                                            //break;
                                                                                                        }
                                                                                                        else if (sourceFeatureLocal.Fields.get_Field(sourceField).Type == esriFieldType.esriFieldTypeDouble ||
                                                                                                            sourceFeatureLocal.Fields.get_Field(sourceField).Type == esriFieldType.esriFieldTypeSingle)
                                                                                                        {
                                                                                                            sourceFeatureLocal.set_Value(sourceField, Convert.ToDouble(test));

                                                                                                            if (ChangeFeatureList == null)
                                                                                                            {
                                                                                                                ChangeFeatureList = new List<IObject>();
                                                                                                            }
                                                                                                            ChangeFeatureList.Add(sourceFeatureLocal);
                                                                                                            found = true;

                                                                                                        }
                                                                                                        else
                                                                                                        {
                                                                                                            sourceFeatureLocal.set_Value(sourceField, test as object);

                                                                                                            if (ChangeFeatureList == null)
                                                                                                            {
                                                                                                                ChangeFeatureList = new List<IObject>();
                                                                                                            }
                                                                                                            ChangeFeatureList.Add(sourceFeatureLocal);
                                                                                                            found = true;

                                                                                                        }
                                                                                                    }
                                                                                                    else
                                                                                                    {
                                                                                                        sourceFeatureLocal.set_Value(sourceField, test as object);

                                                                                                        if (ChangeFeatureList == null)
                                                                                                        {
                                                                                                            ChangeFeatureList = new List<IObject>();
                                                                                                        }
                                                                                                        ChangeFeatureList.Add(sourceFeatureLocal);
                                                                                                        found = true;

                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                            else if (sourceFeatureLocal.Class == inFeature.Class && sourceFeatureLocal.OID != inFeature.OID)
                                                                                            {
                                                                                                if (sourceFeatureLocal.Fields.get_Field(sourceField).Type == esriFieldType.esriFieldTypeString)
                                                                                                {
                                                                                                    sourceFeatureLocal.set_Value(sourceField, test);

                                                                                                    if (ChangeFeatureList == null)
                                                                                                    {
                                                                                                        ChangeFeatureList = new List<IObject>();
                                                                                                    }
                                                                                                    ChangeFeatureList.Add(sourceFeatureLocal);
                                                                                                    found = true;

                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    if (Globals.IsNumeric(test))
                                                                                                    {
                                                                                                        if (sourceFeatureLocal.Fields.get_Field(sourceField).Type == esriFieldType.esriFieldTypeSmallInteger ||
                                                                                                            sourceFeatureLocal.Fields.get_Field(sourceField).Type == esriFieldType.esriFieldTypeInteger)
                                                                                                        {

                                                                                                            sourceFeatureLocal.set_Value(sourceField, Convert.ToInt32(test));

                                                                                                            if (ChangeFeatureList == null)
                                                                                                            {
                                                                                                                ChangeFeatureList = new List<IObject>();
                                                                                                            }
                                                                                                            ChangeFeatureList.Add(sourceFeatureLocal);
                                                                                                            found = true;

                                                                                                        }
                                                                                                        else if (sourceFeatureLocal.Fields.get_Field(sourceField).Type == esriFieldType.esriFieldTypeDouble ||
                                                                                                            sourceFeatureLocal.Fields.get_Field(sourceField).Type == esriFieldType.esriFieldTypeSingle)
                                                                                                        {
                                                                                                            sourceFeatureLocal.set_Value(sourceField, Convert.ToDouble(test));

                                                                                                            if (ChangeFeatureList == null)
                                                                                                            {
                                                                                                                ChangeFeatureList = new List<IObject>();
                                                                                                            }
                                                                                                            ChangeFeatureList.Add(sourceFeatureLocal);
                                                                                                            found = true;

                                                                                                        }
                                                                                                        else
                                                                                                        {
                                                                                                            sourceFeatureLocal.set_Value(sourceField, test as object);

                                                                                                            if (ChangeFeatureList == null)
                                                                                                            {
                                                                                                                ChangeFeatureList = new List<IObject>();
                                                                                                            }
                                                                                                            ChangeFeatureList.Add(sourceFeatureLocal);
                                                                                                            found = true;

                                                                                                        }
                                                                                                    }
                                                                                                    else
                                                                                                    {
                                                                                                        sourceFeatureLocal.set_Value(sourceField, test as object);

                                                                                                        if (ChangeFeatureList == null)
                                                                                                        {
                                                                                                            ChangeFeatureList = new List<IObject>();
                                                                                                        }
                                                                                                        ChangeFeatureList.Add(sourceFeatureLocal);
                                                                                                        found = true;

                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                        catch
                                                                                        {
                                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14al"));
                                                                                        }
                                                                                        finally
                                                                                        {

                                                                                        }

                                                                                    }

                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14am") + sourceFieldName);
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14am") + sourceFieldName);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14b") + sourceLayerName);
                                                                        }

                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14c") + sourceLayerName);
                                                                    }
                                                                }
                                                            }
                                                            if (found)
                                                            {
                                                                break;

                                                            }

                                                        }

                                                    }
                                                    fLocalCursor = null;
                                                    sourceFeatureLocal = null;
                                                }
                                                catch (Exception ex)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "UPDATE_INTERSECTING_FEATURE" + Environment.NewLine + ex.Message);
                                                }

                                                finally
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "UPDATE_INTERSECTING_FEATURE");

                                                }
                                                break;

                                            }
                                        case "MULTI_FIELD_INTERSECT":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "MULTI_FIELD_INTERSECT");
                                                if (inFeature != null & valData != null)
                                                {
                                                    sourceLayerName = "";
                                                    sourceFieldName = "";
                                                    sourceField = -1;
                                                    found = false;
                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    int popFldIdx = 0;
                                                    if (args.GetLength(0) > 2)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain114"));

                                                        sourceLayerNames = args[0].ToString().Split(',');
                                                        sourceFieldName = args[1].ToString().Trim();
                                                        string[] fieldsToPop = args[2].ToString().Split(',');
                                                        if (args.GetLength(0) == 4)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain129"));

                                                            if (Globals.IsDouble(args[3]))
                                                            {
                                                                searchDistance = Convert.ToDouble(args[3]);
                                                            }
                                                            else
                                                            {
                                                                searchDistance = 0.0;
                                                            }
                                                        }
                                                        else
                                                        {

                                                            searchDistance = 0.0;
                                                        }

                                                        if (sourceFieldName != null)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain130"));

                                                            for (int i = 0; i < sourceLayerNames.Length; i++)
                                                            {
                                                                if (fieldsToPop.Length == popFldIdx)
                                                                    break;

                                                                sourceLayerName = sourceLayerNames[i].ToString().Trim();
                                                                if (sourceLayerName != "")
                                                                {

                                                                    boolLayerOrFC = true;
                                                                    if (sourceLayerName.Contains("("))
                                                                    {
                                                                        string[] tempSplt = sourceLayerName.Split('(');
                                                                        sourceLayerName = tempSplt[0].Trim();
                                                                        sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);
                                                                        if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                    }

                                                                    else
                                                                    {
                                                                        sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);
                                                                    }
                                                                    if (sourceLayer != null)
                                                                    {
                                                                        if (sourceLayer.FeatureClass != null)
                                                                        {
                                                                            sourceField = Globals.GetFieldIndex(sourceLayer.FeatureClass.Fields, sourceFieldName);

                                                                            if (sourceField > -1)
                                                                            {

                                                                                sFilter = Globals.createSpatialFilter(sourceLayer, inFeature, false);

                                                                                pFS = (IFeatureSelection)sourceLayer;
                                                                                if (boolLayerOrFC)
                                                                                {
                                                                                    if (pFS.SelectionSet.Count > 0)
                                                                                    {
                                                                                        pFS.SelectionSet.Search(sFilter, true, out cCurs);
                                                                                        fCursor = cCurs as IFeatureCursor;

                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        fCursor = sourceLayer.Search(sFilter, true);
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    fCursor = sourceLayer.FeatureClass.Search(sFilter, true);
                                                                                }

                                                                                while ((sourceFeature = fCursor.NextFeature()) != null)
                                                                                {
                                                                                    if (sourceFeature.Class != inFeature.Class)
                                                                                    {
                                                                                        if (fieldsToPop.Length == popFldIdx)
                                                                                            break;

                                                                                        string test = sourceFeature.get_Value(sourceField).ToString().Trim();

                                                                                        int tempFieldNum = Globals.GetFieldIndex(inObject.Fields, fieldsToPop[popFldIdx]);
                                                                                        popFldIdx++;
                                                                                        if (tempFieldNum > -1)
                                                                                        {
                                                                                            inObject.set_Value(tempFieldNum, sourceFeature.get_Value(sourceField));
                                                                                        }

                                                                                    }
                                                                                    else if (sourceFeature.Class == inFeature.Class && sourceFeature.OID != inFeature.OID)
                                                                                    {
                                                                                        if (fieldsToPop.Length == popFldIdx)
                                                                                            break;

                                                                                        string test = sourceFeature.get_Value(sourceField).ToString().Trim();

                                                                                        int tempFieldNum = Globals.GetFieldIndex(inObject.Fields, fieldsToPop[popFldIdx]);
                                                                                        popFldIdx++;
                                                                                        if (tempFieldNum > -1)
                                                                                        {
                                                                                            inObject.set_Value(tempFieldNum, sourceFeature.get_Value(sourceField));
                                                                                        }

                                                                                    }
                                                                                }

                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14am") + sourceFieldName);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14f") + sourceLayerName);
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14c") + sourceLayerName);
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14e"));

                                                                }
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14az"));

                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ba"));

                                                    }

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "MULTI_FIELD_INTERSECT: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "MULTI_FIELD_INTERSECT");
                                            }
                                            break;
                                        case "INTERSECT_STATS":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "INTERSECT_STATS");
                                                if (inFeature != null & valData != null)
                                                {
                                                    sourceLayerName = "";
                                                    sourceFieldName = "";
                                                    sourceField = -1;
                                                    found = false;
                                                    //LayerToIntersect|Field To Elevate
                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    int AverageCount = 0;
                                                    if (args.GetLength(0) > 2)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain114"));

                                                        sourceLayerNames = args[0].ToString().Split(',');
                                                        sourceFieldName = args[1].ToString().Trim();
                                                        string statType = args[2].ToString().Trim();
                                                        if (args.GetLength(0) == 4)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain129"));

                                                            if (Globals.IsDouble(args[3]))
                                                                searchDistance = Convert.ToDouble(args[3]);
                                                            else
                                                                searchDistance = 0.0;
                                                        }
                                                        else
                                                        {

                                                            searchDistance = 0.0;
                                                        }
                                                        double result = -999999.1;
                                                        string textRes = "";
                                                        if (sourceFieldName != null)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain130"));

                                                            for (int i = 0; i < sourceLayerNames.Length; i++)
                                                            {

                                                                sourceLayerName = sourceLayerNames[i].ToString().Trim();
                                                                if (sourceLayerName != "")
                                                                {
                                                                    boolLayerOrFC = true;
                                                                    if (sourceLayerName.Contains("("))
                                                                    {
                                                                        string[] tempSplt = sourceLayerName.Split('(');
                                                                        sourceLayerName = tempSplt[0].Trim();
                                                                        sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);
                                                                        if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                    }

                                                                    else
                                                                    {
                                                                        sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);
                                                                    }

                                                                    if (sourceLayer != null)
                                                                    {
                                                                        if (sourceLayer.FeatureClass != null)
                                                                        {
                                                                            sourceField = Globals.GetFieldIndex(sourceLayer.FeatureClass.Fields, sourceFieldName);

                                                                            if (sourceField > -1)
                                                                            {

                                                                                sFilter = Globals.createSpatialFilter(sourceLayer, inFeature, false);

                                                                                pFS = (IFeatureSelection)sourceLayer;
                                                                                if (boolLayerOrFC)
                                                                                {
                                                                                    if (pFS.SelectionSet.Count > 0)
                                                                                    {
                                                                                        pFS.SelectionSet.Search(sFilter, true, out cCurs);
                                                                                        fCursor = cCurs as IFeatureCursor;

                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        fCursor = sourceLayer.Search(sFilter, true);
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    fCursor = sourceLayer.FeatureClass.Search(sFilter, true);
                                                                                }
                                                                                sourceFeature = fCursor.NextFeature();
                                                                                while (sourceFeature != null)
                                                                                {
                                                                                    if (sourceFeature.Class != inFeature.Class)
                                                                                    {
                                                                                        string test = sourceFeature.get_Value(sourceField).ToString().Trim();
                                                                                        if (Globals.IsNumeric(test))
                                                                                        {

                                                                                            double valToTest = Convert.ToDouble(test);
                                                                                            if (result == -999999.1)
                                                                                            {
                                                                                                result = valToTest;

                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                switch (statType.ToUpper())
                                                                                                {
                                                                                                    case "MAX":
                                                                                                        if (result < valToTest)
                                                                                                        {
                                                                                                            result = valToTest;

                                                                                                        }
                                                                                                        break;
                                                                                                    case "MIN":
                                                                                                        if (result > valToTest)
                                                                                                        {
                                                                                                            result = valToTest;

                                                                                                        }
                                                                                                        break;
                                                                                                    case "SUM":
                                                                                                        result += valToTest;

                                                                                                        break;
                                                                                                    case "AVERAGE":
                                                                                                        result += valToTest;
                                                                                                        AverageCount++;
                                                                                                        break;
                                                                                                    case "MEAN":
                                                                                                        result += valToTest;
                                                                                                        AverageCount++;

                                                                                                        break;
                                                                                                    case "CONCAT":
                                                                                                        if (textRes.Contains(valToTest.ToString() + ConcatDelim))
                                                                                                        {
                                                                                                        }
                                                                                                        else if (textRes.Contains(ConcatDelim + valToTest.ToString()))
                                                                                                        {
                                                                                                        }
                                                                                                        else
                                                                                                        {

                                                                                                            if (textRes == "")
                                                                                                            {
                                                                                                                textRes += valToTest.ToString();
                                                                                                            }
                                                                                                            else
                                                                                                            {
                                                                                                                textRes += ConcatDelim + valToTest.ToString();
                                                                                                            }

                                                                                                        }

                                                                                                        break;
                                                                                                    default:
                                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ai") + test);
                                                                                                        break;
                                                                                                }

                                                                                            }
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            switch (statType.ToUpper())
                                                                                            {

                                                                                                case "CONCAT":
                                                                                                    if (textRes.Contains(test.ToString() + ConcatDelim))
                                                                                                    {
                                                                                                    }
                                                                                                    else if (textRes.Contains(ConcatDelim + test.ToString()))
                                                                                                    {
                                                                                                    }
                                                                                                    else
                                                                                                    {

                                                                                                        if (textRes == "")
                                                                                                        {
                                                                                                            textRes += test;
                                                                                                        }
                                                                                                        else
                                                                                                        {
                                                                                                            textRes += ConcatDelim + test;
                                                                                                        }
                                                                                                    }

                                                                                                    break;
                                                                                                default:
                                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14d") + test);

                                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ai") + test);
                                                                                                    break;
                                                                                            }

                                                                                        }

                                                                                    }
                                                                                    else if (sourceFeature.Class == inFeature.Class && sourceFeature.OID != inFeature.OID)
                                                                                    {
                                                                                        string test = sourceFeature.get_Value(sourceField).ToString();
                                                                                        if (Globals.IsNumeric(test))
                                                                                        {

                                                                                            double valToTest = Convert.ToDouble(test);
                                                                                            if (result == -999999.1)
                                                                                            {
                                                                                                result = valToTest;

                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                switch (statType.ToUpper())
                                                                                                {
                                                                                                    case "MAX":
                                                                                                        if (result < valToTest)
                                                                                                        {
                                                                                                            result = valToTest;

                                                                                                        }
                                                                                                        break;
                                                                                                    case "MIN":
                                                                                                        if (result > valToTest)
                                                                                                        {
                                                                                                            result = valToTest;

                                                                                                        }
                                                                                                        break;
                                                                                                    case "SUM":
                                                                                                        result += valToTest;

                                                                                                        break;
                                                                                                    case "AVERAGE":
                                                                                                        result += valToTest;
                                                                                                        AverageCount++;
                                                                                                        break;
                                                                                                    case "MEAN":
                                                                                                        result += valToTest;
                                                                                                        AverageCount++;

                                                                                                        break;
                                                                                                    case "CONCAT":
                                                                                                        if (textRes.Contains(valToTest.ToString() + ConcatDelim))
                                                                                                        {
                                                                                                        }
                                                                                                        else if (textRes.Contains(ConcatDelim + valToTest.ToString()))
                                                                                                        {
                                                                                                        }
                                                                                                        else
                                                                                                        {

                                                                                                            if (textRes == "")
                                                                                                            {
                                                                                                                textRes += valToTest.ToString();
                                                                                                            }
                                                                                                            else
                                                                                                            {
                                                                                                                textRes += ConcatDelim + valToTest.ToString();
                                                                                                            }

                                                                                                        }
                                                                                                        break;
                                                                                                    default:
                                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ai") + test);
                                                                                                        break;
                                                                                                }

                                                                                            }
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            switch (statType.ToUpper())
                                                                                            {

                                                                                                case "CONCAT":
                                                                                                    if (textRes.Contains(test.ToString() + ConcatDelim))
                                                                                                    {
                                                                                                    }
                                                                                                    else if (textRes.Contains(ConcatDelim + test.ToString()))
                                                                                                    {
                                                                                                    }
                                                                                                    else
                                                                                                    {

                                                                                                        if (textRes == "")
                                                                                                        {
                                                                                                            textRes += test;
                                                                                                        }
                                                                                                        else
                                                                                                        {
                                                                                                            textRes += ConcatDelim + test;
                                                                                                        }

                                                                                                    }
                                                                                                    break;
                                                                                                default:
                                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14d") + test);

                                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ai") + test);
                                                                                                    break;
                                                                                            }

                                                                                        }
                                                                                    }
                                                                                    sourceFeature = fCursor.NextFeature();

                                                                                }

                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14am") + sourceFieldName);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14f") + sourceLayerName);
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14c") + sourceLayerName);
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14e"));

                                                                }
                                                            }
                                                            try
                                                            {
                                                                if (textRes != "")
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], textRes);
                                                                }
                                                                else if (result != -999999.1)
                                                                {
                                                                    if (AverageCount != 0)
                                                                    {
                                                                        result = result / AverageCount;
                                                                    }
                                                                    inObject.set_Value(intFldIdxs[0], result);

                                                                }
                                                                else
                                                                {
                                                                    IField field = inObject.Fields.get_Field(intFldIdxs[0]);
                                                                    object newval = field.DefaultValue;
                                                                    if (newval == null)
                                                                    {
                                                                        if (field.IsNullable)
                                                                        {
                                                                            inObject.set_Value(intFldIdxs[0], null);
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        inObject.set_Value(intFldIdxs[0], newval);
                                                                    }
                                                                }
                                                            }
                                                            catch (Exception ex)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aj") + ex.Message);

                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14az"));

                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ba"));

                                                    }

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "INTERSECT_STATS: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "INTERSECT_STATS");
                                            }
                                            break;
                                        case "FEATURE_STATS":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "FEATURE_STATS");
                                                if (inFeature != null & valData != null)
                                                {

                                                    sourceFieldName = "";
                                                    sourceField = -1;
                                                    found = false;
                                                    //LayerToIntersect|Field To Elevate
                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    int AverageCount = 0;
                                                    if (args.GetLength(0) > 1)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain114"));

                                                        string[] sourceFieldNames = args[0].ToString().Split(',');
                                                        string statType = args[1].ToString();

                                                        double result = -999999.1;
                                                        string textRes = "";
                                                        if (sourceFieldNames != null)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain131"));

                                                            for (int i = 0; i < sourceFieldNames.Length; i++)
                                                            {

                                                                sourceFieldName = sourceFieldNames[i].ToString();
                                                                if (sourceFieldName != "")
                                                                {

                                                                    sourceField = Globals.GetFieldIndex(inObject.Fields, sourceFieldName);

                                                                    if (sourceField > -1)
                                                                    {
                                                                        string test = inObject.get_Value(sourceField).ToString();
                                                                        if (Globals.IsNumeric(test))
                                                                        {

                                                                            double valToTest = Convert.ToDouble(test);
                                                                            if (result == -999999.1)
                                                                            {
                                                                                result = valToTest;

                                                                            }
                                                                            else
                                                                            {
                                                                                switch (statType.ToUpper())
                                                                                {
                                                                                    case "MAX":
                                                                                        if (result < valToTest)
                                                                                        {
                                                                                            result = valToTest;

                                                                                        }
                                                                                        break;
                                                                                    case "MIN":
                                                                                        if (result > valToTest)
                                                                                        {
                                                                                            result = valToTest;

                                                                                        }
                                                                                        break;
                                                                                    case "SUM":
                                                                                        result += valToTest;

                                                                                        break;
                                                                                    case "AVERAGE":
                                                                                        result += valToTest;
                                                                                        AverageCount++;
                                                                                        break;
                                                                                    case "MEAN":
                                                                                        result += valToTest;
                                                                                        AverageCount++;

                                                                                        break;
                                                                                    case "CONCAT":
                                                                                        if (textRes.Contains(valToTest.ToString() + ConcatDelim))
                                                                                        {
                                                                                        }
                                                                                        else if (textRes.Contains(ConcatDelim + valToTest.ToString()))
                                                                                        {
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            if (textRes == "")
                                                                                            {
                                                                                                textRes += valToTest.ToString();
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                textRes += ConcatDelim + valToTest.ToString();
                                                                                            }
                                                                                        }

                                                                                        break;
                                                                                    default:
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ai") + test);
                                                                                        break;
                                                                                }

                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            switch (statType.ToUpper())
                                                                            {

                                                                                case "CONCAT":
                                                                                    if (textRes.Contains(test.ToString() + ConcatDelim))
                                                                                    {
                                                                                    }
                                                                                    else if (textRes.Contains(ConcatDelim + test.ToString()))
                                                                                    {
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        if (textRes == "")
                                                                                        {
                                                                                            textRes += test;
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            textRes += ConcatDelim + test;
                                                                                        }
                                                                                    }

                                                                                    break;
                                                                                default:
                                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14d") + test);

                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ai") + test);
                                                                                    break;
                                                                            }
                                                                        }
                                                                    }
                                                                }

                                                            }
                                                            try
                                                            {
                                                                if (textRes != "")
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], textRes);
                                                                }
                                                                else if (result != -999999.1)
                                                                {
                                                                    if (AverageCount != 0)
                                                                    {
                                                                        result = result / AverageCount;
                                                                    }
                                                                    inObject.set_Value(intFldIdxs[0], result);

                                                                }
                                                                else
                                                                {
                                                                    IField field = inObject.Fields.get_Field(intFldIdxs[0]);
                                                                    object newval = field.DefaultValue;
                                                                    if (newval == null)
                                                                    {
                                                                        if (field.IsNullable)
                                                                        {
                                                                            inObject.set_Value(intFldIdxs[0], null);
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        inObject.set_Value(intFldIdxs[0], newval);
                                                                    }
                                                                }
                                                            }
                                                            catch (Exception ex)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aj") + ex.Message);

                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14az"));

                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14ba"));

                                                    }

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "FEATURE_STATS: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "FEATURE_STATS");
                                            }
                                            break;
                                        case "INTERSECTING_EDGE":
                                            try
                                            {
                                                if (valData == null) break;
                                                args = valData.Split('|');
                                                switch (args.GetLength(0))
                                                {
                                                    case 1:
                                                        sourceFieldName = args[0].ToString();
                                                        break;
                                                    case 2:
                                                        sourceFieldName = args[1].ToString();
                                                        break;

                                                    default: break;
                                                }

                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "INTERSECTING_EDGE");

                                                if (inFeature != null)
                                                {
                                                    netFeat = inFeature as INetworkFeature;
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain132"));
                                                    if (netFeat != null)
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain103"));
                                                        if (inFeature.FeatureType == esriFeatureType.esriFTComplexJunction || inFeature.FeatureType == esriFeatureType.esriFTSimpleJunction)
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain104"));
                                                            iJuncFeat = (IJunctionFeature)netFeat;

                                                            ISimpleJunctionFeature iSJunc = iJuncFeat as ISimpleJunctionFeature;
                                                            if (iSJunc == null)
                                                                break;
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain105") + iSJunc.EdgeFeatureCount);
                                                            if (iSJunc.EdgeFeatureCount <= 0)
                                                                break;
                                                            if (iSJunc.EdgeFeatureCount > 0)
                                                            {
                                                                for (int i = 0; i < iSJunc.EdgeFeatureCount; i++)
                                                                {

                                                                    iEdgeFeat = iSJunc.get_EdgeFeature(i);
                                                                    try
                                                                    {

                                                                        IRow pRow = iEdgeFeat as IRow;

                                                                        // verify that field (in junction) to copy exists
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain113"));
                                                                        juncField = Globals.GetFieldIndex(pRow.Fields, sourceFieldName);
                                                                        string test = pRow.get_Value(juncField).ToString();
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain133") + test);
                                                                        inObject.set_Value(intFldIdxs[0], test);
                                                                        continue;
                                                                    }
                                                                    catch
                                                                    {
                                                                    }
                                                                }//end loop
                                                                try
                                                                {

                                                                }
                                                                catch (Exception ex)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aj") + ex.Message);

                                                                }

                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bi"));
                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bj"));
                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bk"));
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "INTERSECTING_EDGE: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "INTERSECTING_EDGE");
                                            }
                                            break;
                                        case "INTERSECTING_FEATURE":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "INTERSECTING_FEATURE");
                                                if (inFeature != null & valData != null)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain134"));
                                                    sourceLayerName = "";
                                                    sourceFieldName = "";
                                                    sourceField = -1;
                                                    found = false;
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain135") + valData);
                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    //if (args.GetLength(0) >= 2)
                                                    if (args.Length >= 2)
                                                    {
                                                        AAState.intersectOptions strOpt = AAState.intersectOptions.First;
                                                        switch (args.Length)
                                                        {
                                                            case 2:
                                                                sourceLayerNames = args[0].ToString().Split(',');
                                                                sourceFieldName = args[1].ToString();
                                                                break;
                                                            case 3:
                                                                sourceLayerNames = args[0].ToString().Split(',');
                                                                sourceFieldName = args[1].ToString();
                                                                switch (args[2].ToString().ToUpper())
                                                                {
                                                                    case "PROMPT":
                                                                        strOpt = AAState.intersectOptions.PromptMulti;
                                                                        break;
                                                                    case "P":
                                                                        strOpt = AAState.intersectOptions.PromptMulti;
                                                                        break;
                                                                    case "CENTROID":
                                                                        strOpt = AAState.intersectOptions.Centroid;
                                                                        break;
                                                                    case "C":
                                                                        strOpt = AAState.intersectOptions.Centroid;
                                                                        break;
                                                                    case "F":
                                                                        strOpt = AAState.intersectOptions.First;
                                                                        break;
                                                                    case "L":
                                                                        strOpt = AAState.intersectOptions.Last;
                                                                        break;
                                                                    case "FIRST":
                                                                        strOpt = AAState.intersectOptions.First;
                                                                        break;
                                                                }
                                                                break;
                                                            default: break;
                                                        }

                                                        if (sourceFieldName != null)
                                                        {
                                                            List<Globals.OptionsToPresent> pFoundFeat = new List<Globals.OptionsToPresent>();

                                                            for (int i = 0; i < sourceLayerNames.Length; i++)
                                                            {
                                                                sourceLayerName = sourceLayerNames[i].ToString().Trim();
                                                                if (sourceLayerName != "")
                                                                {
                                                                    boolLayerOrFC = true;

                                                                    if (sourceLayerName.Contains("("))
                                                                    {
                                                                        string[] tempSplt = sourceLayerName.Split('(');
                                                                        sourceLayerName = tempSplt[0].Trim();
                                                                        sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);

                                                                        if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }

                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                                        {
                                                                            boolLayerOrFC = true;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }
                                                                        else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                                        {
                                                                            boolLayerOrFC = false;
                                                                        }

                                                                    }
                                                                    else
                                                                    {
                                                                        sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);

                                                                    }
                                                                    // Get layer

                                                                    if (sourceLayer != null)
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain136") + sourceLayer.Name);

                                                                        sourceField = Globals.GetFieldIndex(sourceLayer.FeatureClass.Fields, sourceFieldName);
                                                                        AAState.WriteLine("                  " + sourceFieldName + ": at " + sourceField);
                                                                        if (sourceField > -1)
                                                                        {

                                                                            sFilter = Globals.createSpatialFilter(sourceLayer, inFeature, strOpt == AAState.intersectOptions.Centroid);
                                                                            if (sFilter == null)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain137"));
                                                                                continue;
                                                                            }

                                                                            pFS = (IFeatureSelection)sourceLayer;
                                                                            if (boolLayerOrFC)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain138"));
                                                                                if (pFS.SelectionSet.Count > 0)
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain139"));
                                                                                    pFS.SelectionSet.Search(sFilter, true, out cCurs);

                                                                                    fCursor = cCurs as IFeatureCursor;

                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain140"));
                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain141"));
                                                                                    fCursor = sourceLayer.Search(sFilter, true);
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain140"));
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain142"));
                                                                                fCursor = sourceLayer.FeatureClass.Search(sFilter, true);
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain140"));
                                                                            }
                                                                            if (fCursor == null)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain143"));
                                                                                continue;
                                                                            }
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain144"));
                                                                            while ((sourceFeature = fCursor.NextFeature()) != null)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain145"));
                                                                                if (sourceFeature.Class != inFeature.Class)
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain146"));
                                                                                    if (strOpt == AAState.intersectOptions.PromptMulti)
                                                                                    {

                                                                                        Globals.OptionsToPresent pOp = new Globals.OptionsToPresent();
                                                                                        pOp.Display = sourceFeature.get_Value(Globals.GetFieldIndex(sourceFeature.Fields, sourceLayer.DisplayField)).ToString();
                                                                                        pOp.Value = sourceFeature.get_Value(sourceField);

                                                                                        if (pOp.Display.Trim() != "")
                                                                                        {
                                                                                            pOp.Display = sourceLayer.Name + ": " + pOp.Display + " value = " + pOp.Value.ToString();

                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            pOp.Display = sourceLayer.Name + ": " + sourceFeature.OID + " value = " + pOp.Value.ToString();

                                                                                        }

                                                                                        pOp.OID = sourceFeature.OID;
                                                                                        pOp.LayerName = sourceLayer.Name;

                                                                                        pFoundFeat.Add(pOp);
                                                                                    }
                                                                                    else if (strOpt == AAState.intersectOptions.Last)
                                                                                    {

                                                                                        Globals.OptionsToPresent pOp = new Globals.OptionsToPresent();
                                                                                        pOp.Display = sourceFeature.get_Value(Globals.GetFieldIndex(sourceFeature.Fields, sourceLayer.DisplayField)).ToString();
                                                                                        pOp.Value = sourceFeature.get_Value(sourceField);

                                                                                        if (pOp.Display.Trim() != "")
                                                                                        {
                                                                                            pOp.Display = sourceLayer.Name + ": " + pOp.Display + " value = " + pOp.Value.ToString();

                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            pOp.Display = sourceLayer.Name + ": " + sourceFeature.OID + " value = " + pOp.Value.ToString();

                                                                                        }
                                                                                        pOp.OID = sourceFeature.OID;
                                                                                        pOp.LayerName = sourceLayer.Name;

                                                                                        pFoundFeat.Add(pOp);
                                                                                    }

                                                                                    else
                                                                                    {
                                                                                        string test = sourceFeature.get_Value(sourceField).ToString();
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain147") + test);
                                                                                        inObject.set_Value(intFldIdxs[0], sourceFeature.get_Value(sourceField));
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));
                                                                                        found = true;
                                                                                    }
                                                                                }
                                                                                else if (sourceFeature.Class == inFeature.Class && sourceFeature.OID != inFeature.OID)
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain148"));
                                                                                    if (strOpt == AAState.intersectOptions.PromptMulti)
                                                                                    {
                                                                                        Globals.OptionsToPresent pOp = new Globals.OptionsToPresent();
                                                                                        pOp.Display = sourceFeature.get_Value(Globals.GetFieldIndex(sourceFeature.Fields, sourceLayer.DisplayField)).ToString();
                                                                                        pOp.Value = sourceFeature.get_Value(sourceField);

                                                                                        if (pOp.Display.Trim() != "")
                                                                                        {
                                                                                            pOp.Display = sourceLayer.Name + ": " + pOp.Display + " value = " + pOp.Value.ToString();

                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            pOp.Display = sourceLayer.Name + ": " + sourceFeature.OID + " value = " + pOp.Value.ToString();

                                                                                        }
                                                                                        pOp.OID = sourceFeature.OID;
                                                                                        pOp.LayerName = sourceLayer.Name;

                                                                                        pFoundFeat.Add(pOp);
                                                                                    }
                                                                                    else if (strOpt == AAState.intersectOptions.Last)
                                                                                    {
                                                                                        Globals.OptionsToPresent pOp = new Globals.OptionsToPresent();
                                                                                        pOp.Display = sourceFeature.get_Value(Globals.GetFieldIndex(sourceFeature.Fields, sourceLayer.DisplayField)).ToString();
                                                                                        pOp.Value = sourceFeature.get_Value(sourceField);

                                                                                        if (pOp.Display.Trim() != "")
                                                                                        {
                                                                                            pOp.Display = sourceLayer.Name + ": " + pOp.Display + " value = " + pOp.Value.ToString();

                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            pOp.Display = sourceLayer.Name + ": " + sourceFeature.OID + " value = " + pOp.Value.ToString();

                                                                                        }
                                                                                        pOp.OID = sourceFeature.OID;
                                                                                        pOp.LayerName = sourceLayer.Name;

                                                                                        pFoundFeat.Add(pOp);
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        string test = sourceFeature.get_Value(sourceField).ToString();
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain147") + test);

                                                                                        inObject.set_Value(intFldIdxs[0], sourceFeature.get_Value(sourceField));
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));

                                                                                        found = true;
                                                                                    }
                                                                                }
                                                                                if (found == true)
                                                                                    break;

                                                                            }

                                                                            if (found == false && AAState._CheckEnvelope && pFoundFeat.Count == 0)
                                                                            {
                                                                                sFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelEnvelopeIntersects;

                                                                                pFS = (IFeatureSelection)sourceLayer;
                                                                                if (boolLayerOrFC)
                                                                                {
                                                                                    if (pFS.SelectionSet.Count > 0)
                                                                                    {
                                                                                        pFS.SelectionSet.Search(sFilter, true, out cCurs);
                                                                                        fCursor = cCurs as IFeatureCursor;

                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        fCursor = sourceLayer.Search(sFilter, true);
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    fCursor = sourceLayer.FeatureClass.Search(sFilter, true);
                                                                                }
                                                                                sourceFeature = fCursor.NextFeature();
                                                                                while (sourceFeature != null)
                                                                                {
                                                                                    if (strOpt == AAState.intersectOptions.PromptMulti)
                                                                                    {
                                                                                        Globals.OptionsToPresent pOp = new Globals.OptionsToPresent();
                                                                                        pOp.Display = sourceFeature.get_Value(Globals.GetFieldIndex(sourceFeature.Fields, sourceLayer.DisplayField)).ToString();
                                                                                        pOp.Value = sourceFeature.get_Value(sourceField);

                                                                                        if (pOp.Display.Trim() != "")
                                                                                        {
                                                                                            pOp.Display = sourceLayer.Name + ": " + pOp.Display + " value = " + pOp.Value.ToString();

                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            pOp.Display = sourceLayer.Name + ": " + sourceFeature.OID + " value = " + pOp.Value.ToString();

                                                                                        }
                                                                                        pOp.OID = sourceFeature.OID;
                                                                                        pOp.LayerName = sourceLayer.Name;

                                                                                        pFoundFeat.Add(pOp);

                                                                                    }
                                                                                    else if (strOpt == AAState.intersectOptions.Last)
                                                                                    {
                                                                                        Globals.OptionsToPresent pOp = new Globals.OptionsToPresent();
                                                                                        pOp.Display = sourceFeature.get_Value(Globals.GetFieldIndex(sourceFeature.Fields, sourceLayer.DisplayField)).ToString();
                                                                                        pOp.Value = sourceFeature.get_Value(sourceField);

                                                                                        if (pOp.Display.Trim() != "")
                                                                                        {
                                                                                            pOp.Display = sourceLayer.Name + ": " + pOp.Display + " value = " + pOp.Value.ToString();

                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            pOp.Display = sourceLayer.Name + ": " + sourceFeature.OID + " value = " + pOp.Value.ToString();

                                                                                        }
                                                                                        pOp.OID = sourceFeature.OID;
                                                                                        pOp.LayerName = sourceLayer.Name;

                                                                                        pFoundFeat.Add(pOp);

                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        if (found)
                                                                                        {
                                                                                            break;
                                                                                        }
                                                                                        string test = sourceFeature.get_Value(sourceField).ToString();
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain147") + test);

                                                                                        inObject.set_Value(intFldIdxs[0], sourceFeature.get_Value(sourceField));
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));

                                                                                        found = true;

                                                                                    }
                                                                                    sourceFeature = fCursor.NextFeature();
                                                                                }

                                                                            }

                                                                            if (found)
                                                                            {
                                                                                break;
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14am") + sourceFieldName);
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14c") + sourceLayerName);
                                                                    }
                                                                }

                                                            }
                                                            if (pFoundFeat.Count > 0 && strOpt == AAState.intersectOptions.PromptMulti)
                                                            {
                                                                Globals.OptionsToPresent strRetVal = Globals.showOptionsForm(pFoundFeat, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain149") + sourceFieldName, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain149") + sourceFieldName, ComboBoxStyle.DropDownList);
                                                                if (strRetVal != null)
                                                                {
                                                                    //sourceFeature = sourceLayer.FeatureClass.GetFeature(strRetVal.OID);

                                                                    string test = strRetVal.Value.ToString();//sourceFeature.get_Value(sourceField).ToString();
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain147") + test);

                                                                    inObject.set_Value(intFldIdxs[0], strRetVal.Value);
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));

                                                                    found = true;

                                                                }
                                                            }
                                                            else if (pFoundFeat.Count > 0 && strOpt == AAState.intersectOptions.Last)
                                                            {

                                                                //sourceFeature = sourceLayer.FeatureClass.GetFeature(pFoundFeat[pFoundFeat.Count - 1].OID);

                                                                string test = pFoundFeat[pFoundFeat.Count - 1].Value.ToString(); //sourceFeature.get_Value(sourceField).ToString();
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain147") + test);

                                                                inObject.set_Value(intFldIdxs[0], pFoundFeat[pFoundFeat.Count - 1].Value);
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));

                                                                found = true;

                                                            }

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain150"));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain151"));
                                                    }
                                                }
                                                else
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain152"));
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "INTERSECTING_FEATURE: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "INTERSECTING_FEATURE");
                                            }
                                            break;
                                        case "INTERSECTING_BOOLEAN":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "INTERSECTING_BOOLEAN");
                                                if (inFeature != null & valData != null)
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain134"));
                                                    sourceLayerName = "";
                                                    string valTrue = "";
                                                    string valFalse = "";

                                                    found = false;
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain135") + valData);
                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    //if (args.GetLength(0) >= 2)
                                                    if (args.Length == 3)
                                                    {
                                                        AAState.intersectOptions strOpt = AAState.intersectOptions.First;
                                                        switch (args.Length)
                                                        {

                                                            case 3:
                                                                sourceLayerNames = args[0].ToString().Split(',');
                                                                valTrue = args[1].ToString();
                                                                valFalse = args[2].ToString();

                                                                break;
                                                            default: break;
                                                        }

                                                        for (int i = 0; i < sourceLayerNames.Length; i++)
                                                        {
                                                            sourceLayerName = sourceLayerNames[i].ToString().Trim();
                                                            if (sourceLayerName != "")
                                                            {
                                                                boolLayerOrFC = true;

                                                                if (sourceLayerName.Contains("("))
                                                                {
                                                                    string[] tempSplt = sourceLayerName.Split('(');
                                                                    sourceLayerName = tempSplt[0].Trim();
                                                                    sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);

                                                                    if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                                    {
                                                                        boolLayerOrFC = true;
                                                                    }

                                                                    else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                                    {
                                                                        boolLayerOrFC = true;
                                                                    }
                                                                    else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                                    {
                                                                        boolLayerOrFC = false;
                                                                    }
                                                                    else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                                    {
                                                                        boolLayerOrFC = false;
                                                                    }
                                                                    else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                                    {
                                                                        boolLayerOrFC = false;
                                                                    }

                                                                }
                                                                else
                                                                {
                                                                    sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);

                                                                }
                                                                // Get layer

                                                                if (sourceLayer != null)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain136") + sourceLayer.Name);

                                                                    sFilter = Globals.createSpatialFilter(sourceLayer, inFeature, strOpt == AAState.intersectOptions.Centroid);
                                                                    if (sFilter == null)
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain137"));
                                                                        continue;
                                                                    }

                                                                    pFS = (IFeatureSelection)sourceLayer;
                                                                    if (boolLayerOrFC)
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain138"));
                                                                        if (pFS.SelectionSet.Count > 0)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain139"));
                                                                            pFS.SelectionSet.Search(sFilter, true, out cCurs);

                                                                            fCursor = cCurs as IFeatureCursor;

                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain140"));
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain141"));
                                                                            fCursor = sourceLayer.Search(sFilter, true);
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain140"));
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain142"));
                                                                        fCursor = sourceLayer.FeatureClass.Search(sFilter, true);
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain140"));
                                                                    }
                                                                    if (fCursor == null)
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain143"));
                                                                        continue;
                                                                    }
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain144"));
                                                                    while ((sourceFeature = fCursor.NextFeature()) != null)
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain145"));
                                                                        if (sourceFeature.Class != inFeature.Class)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain146"));

                                                                            found = true;

                                                                        }
                                                                        else if (sourceFeature.Class == inFeature.Class && sourceFeature.OID != inFeature.OID)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain148"));

                                                                            found = true;

                                                                        }
                                                                        if (found == true)
                                                                            break;

                                                                    }

                                                                    if (found == false && AAState._CheckEnvelope)
                                                                    {
                                                                        sFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelEnvelopeIntersects;

                                                                        pFS = (IFeatureSelection)sourceLayer;
                                                                        if (boolLayerOrFC)
                                                                        {
                                                                            if (pFS.SelectionSet.Count > 0)
                                                                            {
                                                                                pFS.SelectionSet.Search(sFilter, true, out cCurs);
                                                                                fCursor = cCurs as IFeatureCursor;

                                                                            }
                                                                            else
                                                                            {
                                                                                fCursor = sourceLayer.Search(sFilter, true);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            fCursor = sourceLayer.FeatureClass.Search(sFilter, true);
                                                                        }
                                                                        sourceFeature = fCursor.NextFeature();
                                                                        while (sourceFeature != null)
                                                                        {

                                                                            found = true;
                                                                            break;

                                                                        }

                                                                    }

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14c") + sourceLayerName);
                                                                }

                                                                if (found)
                                                                {
                                                                    break;
                                                                }

                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine("                  " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorWarn_14c") + sourceLayerName);
                                                            }

                                                        }

                                                        if (found)
                                                        {

                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain147") + valTrue);

                                                            inObject.set_Value(intFldIdxs[0], valTrue);
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));

                                                        }
                                                        else
                                                        {
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain147") + valFalse);

                                                            inObject.set_Value(intFldIdxs[0], valFalse);
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14az"));

                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain153"));
                                                    }

                                                }
                                                else
                                                {
                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain154"));
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "INTERSECTING_BOOLEAN: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "INTERSECTING_BOOLEAN");
                                            }
                                            break;
                                        case "INTERSECTING_RASTER":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "INTERSECTING_RASTER");
                                                if (inFeature != null & valData != null)
                                                {

                                                    sourceLayerName = "";
                                                    formatString = "";
                                                    found = false;

                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    if (args.Length < 1) break;
                                                    switch (args.Length)
                                                    {
                                                        case 1:
                                                            sourceLayerNames = args[0].ToString().Split(',');
                                                            break;
                                                        case 2:
                                                            sourceLayerNames = args[0].ToString().Split(',');
                                                            formatString = args[1].ToString();
                                                            break;
                                                        default: break;
                                                    }

                                                    // Get layer
                                                    for (int i = 0; i < sourceLayerNames.Length; i++)
                                                    {
                                                        sourceLayerName = sourceLayerNames[i].ToString().Trim();
                                                        IPoint pLoc = Globals.GetGeomCenter(inFeature)[0];

                                                        if (pLoc != null)
                                                        {
                                                            string cellVal = Globals.GetCellValue(sourceLayerName, pLoc, AAState._editor.Map);
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain155") + sourceLayerName);
                                                            if (cellVal != null && cellVal != "" && cellVal != "No Raster")
                                                            {

                                                                if (formatString == null || formatString == "" || (inObject.Fields.get_Field(intFldIdxs[0]).Type != esriFieldType.esriFieldTypeString))
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], cellVal);
                                                                    found = true;
                                                                    break;
                                                                }
                                                                else
                                                                {
                                                                    formatString = formatString + cellVal;
                                                                    inObject.set_Value(intFldIdxs[0], formatString);

                                                                    found = true;
                                                                    break;
                                                                }

                                                            }

                                                        }
                                                    }
                                                    if (!(found) && inObject.Fields.get_Field(intFldIdxs[0]).IsNullable)
                                                        inObject.set_Value(intFldIdxs[0], null);
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "INTERSECTING_RASTER: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "INTERSECTING_RASTER");
                                            }
                                            break;
                                        case "INTERSECTING_LAYER_DETAILS":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "INTERSECTING_LAYER_DETAILS");
                                                if (inFeature != null & valData != null)
                                                {

                                                    sourceLayerName = "";
                                                    formatString = "";
                                                    found = false;
                                                    List<string> matchPattern = null;
                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    if (args.Length >= 1)
                                                    {
                                                        AAState.intersectOptions strOpt = AAState.intersectOptions.First;

                                                        switch (args.Length)
                                                        {
                                                            case 1:
                                                                sourceLayerNames = args[0].ToString().Split(',');
                                                                formatString = "P";
                                                                break;
                                                            case 2:
                                                                sourceLayerNames = args[0].ToString().Split(',');
                                                                formatString = args[1].ToString();
                                                                break;
                                                            case 3:
                                                                sourceLayerNames = args[0].ToString().Split(',');
                                                                formatString = args[1].ToString();
                                                                switch (args[2].ToString().ToUpper())
                                                                {
                                                                    case "PROMPT":
                                                                        strOpt = AAState.intersectOptions.PromptMulti;
                                                                        break;
                                                                    case "P":
                                                                        strOpt = AAState.intersectOptions.PromptMulti;
                                                                        break;
                                                                    case "CENTROID":
                                                                        strOpt = AAState.intersectOptions.Centroid;
                                                                        break;
                                                                    case "C":
                                                                        strOpt = AAState.intersectOptions.Centroid;
                                                                        break;
                                                                    case "F":
                                                                        strOpt = AAState.intersectOptions.First;
                                                                        break;
                                                                    case "FIRST":
                                                                        strOpt = AAState.intersectOptions.First;
                                                                        break;
                                                                }
                                                                break;
                                                            case 4:
                                                                sourceLayerNames = args[0].ToString().Split(',');
                                                                formatString = args[1].ToString();
                                                                switch (args[2].ToString().ToUpper())
                                                                {
                                                                    case "PROMPT":
                                                                        strOpt = AAState.intersectOptions.PromptMulti;
                                                                        break;
                                                                    case "P":
                                                                        strOpt = AAState.intersectOptions.PromptMulti;
                                                                        break;
                                                                    case "CENTROID":
                                                                        strOpt = AAState.intersectOptions.Centroid;
                                                                        break;
                                                                    case "C":
                                                                        strOpt = AAState.intersectOptions.Centroid;
                                                                        break;
                                                                    case "F":
                                                                        strOpt = AAState.intersectOptions.First;
                                                                        break;
                                                                    case "FIRST":
                                                                        strOpt = AAState.intersectOptions.First;
                                                                        break;
                                                                }
                                                                matchPattern = new List<string>(args[3].ToString().Split(','));

                                                                break;
                                                            default: break;

                                                        }
                                                        List<Globals.OptionsToPresent> strFiles = new List<Globals.OptionsToPresent>();
                                                        // Get layer
                                                        for (int i = 0; i < sourceLayerNames.Length; i++)
                                                        {
                                                            sourceLayerName = sourceLayerNames[i].ToString().Trim();

                                                            IGeometry pGeo = inFeature.ShapeCopy;
                                                            List<IGeometry> pGeos = new List<IGeometry>();

                                                            if (pGeo != null)
                                                            {
                                                                if (strOpt == AAState.intersectOptions.Centroid)
                                                                {
                                                                    List<IPoint> pGeoPnts = Globals.GetGeomCenter(pGeo);
                                                                    pGeos = pGeoPnts.ConvertAll(new Converter<IPoint, IGeometry>(Globals.PointToGeometry));

                                                                }
                                                                else
                                                                {
                                                                    pGeos.Add(pGeo);
                                                                }
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain156") + sourceLayerName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain157"));
                                                                IEnumLayer pEnum = Globals.GetLayers(AAState._editor.Map, sourceLayerName);

                                                                if (pEnum != null)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain158") + sourceLayerName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain157"));
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain159"));
                                                                    ILayer pLay = pEnum.Next();

                                                                    while (pLay != null)
                                                                    {

                                                                        intersectLayerDetailsFunctions(pLay, pGeos, strOpt, ref found, ref strFiles, ref inObject, intFldIdxs[0], matchPattern);

                                                                        if (found)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain160"));
                                                                            break;
                                                                        }

                                                                        pLay = pEnum.Next();
                                                                    }
                                                                    pLay = null;
                                                                    pEnum = null;
                                                                }
                                                                else
                                                                {
                                                                    bool FCorLayerTemp = true;
                                                                    ILayer pLay = Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref FCorLayerTemp);
                                                                    if (pLay != null)
                                                                    {

                                                                        intersectLayerDetailsFunctions(pLay, pGeos, strOpt, ref found, ref strFiles, ref inObject, intFldIdxs[0], matchPattern);

                                                                    }
                                                                    pLay = null;
                                                                }

                                                                if (pEnum != null)
                                                                    Marshal.ReleaseComObject(pEnum);
                                                                pEnum = null;
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain161"));
                                                            }
                                                            if (found)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain160"));
                                                                break;
                                                            }
                                                            pGeo = null;
                                                            pGeos = null;
                                                        }
                                                        if (strOpt == AAState.intersectOptions.PromptMulti && strFiles.Count > 0)
                                                        {
                                                            Globals.OptionsToPresent strRetVal = Globals.showOptionsForm(strFiles, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain162") + strFldNames[0], A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain163") + strFldNames[0], ComboBoxStyle.DropDownList);
                                                            if (strRetVal != null)
                                                            {
                                                                try
                                                                {
                                                                    inObject.set_Value(intFldIdxs[0], strRetVal.Display);
                                                                }
                                                                catch
                                                                {
                                                                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain164"));

                                                                }
                                                                found = true;
                                                            }
                                                        }

                                                    }
                                                    else
                                                    {
                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain165"));
                                                    }

                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "INTERSECTING_LAYER_DETAILS: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "INTERSECTING_LAYER_DETAILS");
                                            }
                                            break;
                                        case "INTERSECTING_FEATURE_DISTANCE":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "INTERSECTING_FEATURE_DISTANCE");
                                                if (inFeature != null & valData != null)
                                                {
                                                    sourceLayerName = "";
                                                    sourceFieldName = "";
                                                    sourceField = -1;

                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    if (args.GetLength(0) >= 2)
                                                    {

                                                        sourceLayerNames = args[0].ToString().Split(',');
                                                        sourceFieldName = args[1].ToString().Trim();
                                                    }
                                                    // Get layer

                                                    if (sourceFieldName != null)
                                                    {
                                                        for (int i = 0; i < sourceLayerNames.Length; i++)
                                                        {
                                                            sourceLayerName = sourceLayerNames[i].ToString();
                                                            if (sourceLayerName != "")

                                                                sourceLayerName = args[i].ToString();
                                                            if (i == 0)
                                                                i++;
                                                            boolLayerOrFC = true;

                                                            if (sourceLayerName.Contains("("))
                                                            {
                                                                string[] tempSplt = sourceLayerName.Split('(');
                                                                sourceLayerName = tempSplt[0];
                                                                sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);

                                                                if (tempSplt[1].ToUpper().Contains("LAYER)"))
                                                                {
                                                                    boolLayerOrFC = true;
                                                                }
                                                                else if (tempSplt[1].ToUpper().Contains("FEATURELAYER)"))
                                                                {
                                                                    boolLayerOrFC = true;
                                                                }
                                                                else if (tempSplt[1].ToUpper().Contains("FEATURECLASS)"))
                                                                {
                                                                    boolLayerOrFC = false;
                                                                }
                                                                else if (tempSplt[1].ToUpper().Contains("CLASS)"))
                                                                {
                                                                    boolLayerOrFC = false;
                                                                }
                                                                else if (tempSplt[1].ToUpper().Contains("FEATURE)"))
                                                                {
                                                                    boolLayerOrFC = false;
                                                                }
                                                                else
                                                                {
                                                                    boolLayerOrFC = true;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                sourceLayer = (IFeatureLayer)Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref boolLayerOrFC);

                                                            }
                                                            if (sourceLayer == null)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14b") + sourceLayerName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                continue;
                                                            }

                                                            IFeatureClass iFC = inFeature.Class as IFeatureClass;
                                                            if (sourceLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + sourceLayer + " is a polygon layer");

                                                                break;
                                                            }
                                                            if (sourceLayer != null)
                                                            {
                                                                sourceField = Globals.GetFieldIndex(sourceLayer.FeatureClass.Fields, sourceFieldName);

                                                                if (sourceField > -1)
                                                                {
                                                                    sFilter = Globals.createSpatialFilter(sourceLayer, inFeature, false);

                                                                    pFS = (IFeatureSelection)sourceLayer;
                                                                    if (boolLayerOrFC)
                                                                    {
                                                                        if (pFS.SelectionSet.Count > 0)
                                                                        {
                                                                            pFS.SelectionSet.Search(sFilter, true, out cCurs);
                                                                            fCursor = cCurs as IFeatureCursor;

                                                                        }
                                                                        else
                                                                        {
                                                                            fCursor = sourceLayer.Search(sFilter, true);
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        fCursor = sourceLayer.FeatureClass.Search(sFilter, true);
                                                                    }

                                                                    while ((sourceFeature = fCursor.NextFeature()) != null)
                                                                    {
                                                                        if (sourceFeature.Class != inFeature.Class)
                                                                        {
                                                                            IPoint pIntPnt;
                                                                            if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline)
                                                                            {
                                                                                pIntPnt = Globals.GetIntersection(inFeature.ShapeCopy, sourceFeature.ShapeCopy as IPolyline) as IPoint;

                                                                            }
                                                                            else
                                                                                pIntPnt = inFeature.ShapeCopy as IPoint;
                                                                            IPoint snapPnt = null;

                                                                            double dAlong = Globals.PointDistanceOnLine(pIntPnt, sourceFeature.Shape as IPolyline, 2, out snapPnt);
                                                                            snapPnt = null;

                                                                            string strUnit = Globals.GetSpatRefUnitName(Globals.GetLayersCoordinateSystem(sourceLayer.FeatureClass), true);
                                                                            if (strUnit == "Foot" && dAlong != 1)
                                                                            {
                                                                                strUnit = "Feet";
                                                                            }
                                                                            else if (strUnit == "Meter" && dAlong != 1)
                                                                            {
                                                                                strUnit = "Meters";
                                                                            }
                                                                            string strDis = dAlong + " " + strUnit + " along " + sourceLayer.Name + " with " + sourceLayer.FeatureClass.Fields.get_Field(sourceField).AliasName + A4LGSharedFunctions.Localizer.GetString("Of") + sourceFeature.get_Value(sourceField);

                                                                            if (inObject.Fields.get_Field(intFldIdxs[0]).Length < strDis.Length - 1)
                                                                            {

                                                                                strDis = dAlong + " " + strUnit + ": " + sourceFeature.get_Value(sourceField);
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain166") + strDis);

                                                                                if (inObject.Fields.get_Field(intFldIdxs[0]).Length < strDis.Length - 1)
                                                                                {

                                                                                    if (inObject.Fields.get_Field(intFldIdxs[0]).Length < strDis.Length - 1)
                                                                                    {
                                                                                        strDis = dAlong.ToString();
                                                                                        inObject.set_Value(intFldIdxs[0], strDis);
                                                                                        break;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        inObject.set_Value(intFldIdxs[0], strDis);
                                                                                        break;
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    strDis = dAlong.ToString();
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain166") + strDis);
                                                                                    if (inObject.Fields.get_Field(intFldIdxs[0]).Length < strDis.Length - 1)
                                                                                    {
                                                                                        strDis = dAlong.ToString();
                                                                                        inObject.set_Value(intFldIdxs[0], strDis);
                                                                                        break;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        inObject.set_Value(intFldIdxs[0], strDis);
                                                                                        break;
                                                                                    }
                                                                                }

                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain167") + strDis);
                                                                                inObject.set_Value(intFldIdxs[0], strDis);
                                                                                break;
                                                                            }
                                                                        }

                                                                        else if (sourceFeature.Class == inFeature.Class && sourceFeature.OID != inFeature.OID)
                                                                        {
                                                                            IPoint pIntPnt;
                                                                            if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline)
                                                                            {
                                                                                pIntPnt = Globals.GetIntersection(inFeature.ShapeCopy, sourceFeature.ShapeCopy as IPolyline) as IPoint;

                                                                            }
                                                                            else
                                                                                pIntPnt = inFeature.ShapeCopy as IPoint;
                                                                            IPoint snapPnt = null;

                                                                            double dAlong = Globals.PointDistanceOnLine(pIntPnt, sourceFeature.Shape as IPolyline, 2, out snapPnt);
                                                                            snapPnt = null;

                                                                            string strUnit = Globals.GetSpatRefUnitName(Globals.GetLayersCoordinateSystem(sourceLayer.FeatureClass), true);
                                                                            if (strUnit == "Foot" && dAlong != 1)
                                                                            {
                                                                                strUnit = "Feet";
                                                                            }
                                                                            else if (strUnit == "Meter" && dAlong != 1)
                                                                            {
                                                                                strUnit = "Meters";
                                                                            }
                                                                            string strDis = dAlong + " " + strUnit + " along " + sourceLayer.Name + " with " + sourceLayer.FeatureClass.Fields.get_Field(sourceField).AliasName + A4LGSharedFunctions.Localizer.GetString("Of") + sourceFeature.get_Value(sourceField);

                                                                            if (inObject.Fields.get_Field(intFldIdxs[0]).Length < strDis.Length - 1)
                                                                            {

                                                                                strDis = dAlong + " " + strUnit + ": " + sourceFeature.get_Value(sourceField);
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain166") + strDis);

                                                                                if (inObject.Fields.get_Field(intFldIdxs[0]).Length < strDis.Length - 1)
                                                                                {

                                                                                    if (inObject.Fields.get_Field(intFldIdxs[0]).Length < strDis.Length - 1)
                                                                                    {
                                                                                        strDis = dAlong.ToString();
                                                                                        inObject.set_Value(intFldIdxs[0], strDis);
                                                                                        break;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        inObject.set_Value(intFldIdxs[0], strDis);
                                                                                        break;
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    strDis = dAlong.ToString();
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain166") + strDis);
                                                                                    if (inObject.Fields.get_Field(intFldIdxs[0]).Length < strDis.Length - 1)
                                                                                    {
                                                                                        strDis = dAlong.ToString();
                                                                                        inObject.set_Value(intFldIdxs[0], strDis);
                                                                                        break;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        inObject.set_Value(intFldIdxs[0], strDis);
                                                                                        break;
                                                                                    }
                                                                                }

                                                                            }
                                                                            else
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain167") + strDis);
                                                                                inObject.set_Value(intFldIdxs[0], strDis);
                                                                                break;
                                                                            }
                                                                        }
                                                                    }

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + sourceLayer + ": field: " + sourceFieldName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                }
                                                            }
                                                            else { }
                                                        }
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "INTERSECTING_FEATURE_DISTANCE: " + ex.Message);
                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "INTERSECTING_FEATURE_DISTANCE");
                                            }
                                            break;

                                        //Release: 1.2
                                        //New Dynamic Value Method: NEARSET_FEATURE - similiar to INTERSECTING_FEATURE but requires a search distance.

                                        case "NEAREST_FEATURE":
                                            try
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ar") + "NEAREST_FEATURE");
                                                if (inFeature != null & valData != null)
                                                {
                                                    string sourceMatField = "";
                                                    string targetMatField = "";
                                                    sourceLayerName = "";
                                                    sourceFieldName = "";
                                                    searchDistance = 0;
                                                    found = false;
                                                    // Parse arguments
                                                    args = valData.Split('|');
                                                    switch (args.Length)
                                                    {
                                                        case 2:
                                                            sourceLayerNames = args[0].ToString().Split(',');
                                                            sourceFieldName = args[1].ToString();
                                                            break;
                                                        case 3:
                                                            sourceLayerNames = args[0].ToString().Split(',');
                                                            sourceFieldName = args[1].ToString();

                                                            Double.TryParse(args[2], out searchDistance);
                                                            break;
                                                        case 4:
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain168"));
                                                            break;

                                                        case 5:
                                                            sourceLayerNames = args[0].ToString().Split(',');
                                                            sourceFieldName = args[1].ToString();
                                                            Double.TryParse(args[2], out searchDistance);
                                                            sourceMatField = args[3].ToString();
                                                            targetMatField = args[4].ToString();
                                                            break;
                                                        default:
                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain168"));
                                                            break;

                                                    }

                                                    if (sourceLayerNames.Length > 0 & sourceFieldName != null)
                                                    {
                                                        for (int i = 0; i < sourceLayerNames.Length; i++)
                                                        {
                                                            sourceLayerName = sourceLayerNames[i].ToString();
                                                            if (sourceLayerName != "")
                                                            {
                                                                bool FCorLayerSource = true;
                                                                sourceLayer = Globals.FindLayer(AAState._editor.Map, sourceLayerName, ref FCorLayerSource) as IFeatureLayer;
                                                                if (sourceLayer != null)
                                                                {
                                                                    sourceField = Globals.GetFieldIndex(sourceLayer.FeatureClass.Fields, sourceFieldName);

                                                                    if (sourceField > -1)
                                                                    {

                                                                        sFilter = Globals.createSpatialFilter(sourceLayer, inFeature, searchDistance, false);
                                                                        pFS = (IFeatureSelection)sourceLayer;
                                                                        if (boolLayerOrFC)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain169"));
                                                                            if (pFS.SelectionSet.Count > 0)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain170"));
                                                                                pFS.SelectionSet.Search(sFilter, false, out cCurs);
                                                                                fCursor = cCurs as IFeatureCursor;

                                                                            }
                                                                            else
                                                                            {

                                                                                fCursor = sourceLayer.Search(sFilter, false);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain171"));
                                                                            fCursor = sourceLayer.FeatureClass.Search(sFilter, false);
                                                                        }

                                                                        nearestFeature = null;

                                                                        proxOp = (IProximityOperator)inFeature.ShapeCopy;
                                                                        lastDistance = searchDistance;
                                                                        while ((sourceFeature = fCursor.NextFeature()) != null)
                                                                        {
                                                                            if (sourceFeature.Class != inFeature.Class)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain172"));
                                                                                if (targetMatField == "" && sourceMatField == "")
                                                                                {

                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain173"));
                                                                                    try
                                                                                    {
                                                                                        IGeometry pTempGeo = sourceFeature.ShapeCopy;
                                                                                        pTempGeo.Project(inFeature.Shape.SpatialReference);

                                                                                        distance = proxOp.ReturnDistance(pTempGeo);
                                                                                        pTempGeo = null;

                                                                                        if (distance <= lastDistance)
                                                                                        {
                                                                                            nearestFeature = sourceFeature;
                                                                                            lastDistance = distance;
                                                                                        }
                                                                                        pTempGeo = null;
                                                                                    }
                                                                                    catch
                                                                                    {
                                                                                        MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain174"));
                                                                                        return false;

                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain175"));
                                                                                    int idxTargetFld = Globals.GetFieldIndex(sourceLayer, targetMatField);
                                                                                    int idxSourceFld = Globals.GetFieldIndex(inObject.Fields, sourceMatField);
                                                                                    if (idxSourceFld >= 0 && idxTargetFld >= 0)
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain176"));
                                                                                        if (inObject.get_Value(idxSourceFld).ToString() == sourceFeature.get_Value(idxTargetFld).ToString())
                                                                                        {
                                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                                            IGeometry pTempGeo = sourceFeature.ShapeCopy;
                                                                                            pTempGeo.Project(inFeature.Shape.SpatialReference);

                                                                                            distance = proxOp.ReturnDistance(pTempGeo);
                                                                                            pTempGeo = null;

                                                                                            if (distance <= lastDistance)
                                                                                            {
                                                                                                nearestFeature = sourceFeature;
                                                                                                lastDistance = distance;
                                                                                            }
                                                                                            pTempGeo = null;

                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            AAState.WriteLine("                  Values does not Match: " + inObject.get_Value(idxSourceFld).ToString() + " - " + sourceFeature.get_Value(idxTargetFld).ToString());

                                                                                        }

                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain177"));
                                                                                        IGeometry pTempGeo = sourceFeature.ShapeCopy;
                                                                                        pTempGeo.Project(inFeature.Shape.SpatialReference);

                                                                                        distance = proxOp.ReturnDistance(pTempGeo);
                                                                                        pTempGeo = null;

                                                                                        if (distance <= lastDistance)
                                                                                        {
                                                                                            nearestFeature = sourceFeature;
                                                                                            lastDistance = distance;
                                                                                        }
                                                                                        pTempGeo = null;

                                                                                    }

                                                                                }
                                                                            }
                                                                            else if (sourceFeature.Class == inFeature.Class && sourceFeature.OID != inFeature.OID)
                                                                            {
                                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain175"));
                                                                                int idxTargetFld = Globals.GetFieldIndex(sourceLayer, targetMatField);
                                                                                int idxSourceFld = Globals.GetFieldIndex(inObject.Fields, sourceMatField);
                                                                                if (idxSourceFld >= 0 && idxTargetFld >= 0)
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain176"));
                                                                                    if (inObject.get_Value(idxSourceFld).ToString() == sourceFeature.get_Value(idxTargetFld).ToString())
                                                                                    {
                                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ay"));
                                                                                        IGeometry pTempGeo = sourceFeature.ShapeCopy;
                                                                                        pTempGeo.Project(inFeature.Shape.SpatialReference);

                                                                                        distance = proxOp.ReturnDistance(pTempGeo);
                                                                                        pTempGeo = null;

                                                                                        if (distance <= lastDistance)
                                                                                        {
                                                                                            nearestFeature = sourceFeature;
                                                                                            lastDistance = distance;
                                                                                        }
                                                                                        pTempGeo = null;

                                                                                    }

                                                                                }
                                                                                else
                                                                                {
                                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain177"));
                                                                                    IGeometry pTempGeo = sourceFeature.ShapeCopy;
                                                                                    pTempGeo.Project(inFeature.Shape.SpatialReference);

                                                                                    distance = proxOp.ReturnDistance(pTempGeo);
                                                                                    pTempGeo = null;

                                                                                    if (distance <= lastDistance)
                                                                                    {
                                                                                        nearestFeature = sourceFeature;
                                                                                        lastDistance = distance;
                                                                                    }
                                                                                    pTempGeo = null;
                                                                                }

                                                                            }

                                                                        }

                                                                        if (nearestFeature != null)
                                                                        {
                                                                            AAState.WriteLine("                  Feature found: " + nearestFeature.Class.AliasName + ":" + nearestFeature.OID);
                                                                            inObject.set_Value(intFldIdxs[0], nearestFeature.get_Value(sourceField));
                                                                            found = true;
                                                                            break;
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + sourceLayer + ": field: " + sourceFieldName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                    }

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a")  + sourceLayer + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                                                                }
                                                            }
                                                            else
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain178"));
                                                            }

                                                        }
                                                        if (!found)
                                                        {

                                                        }
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + "NEAREST_FEATURE: " + ex.Message);

                                            }
                                            finally
                                            {
                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14as") + "NEAREST_FEATURE");
                                            }
                                            break;

                                        default:
                                            AAState.WriteLine("ERROR: " + valMethod + " for layer " + tableName + " is not a valid method, check the dynamic value table");

                                            break;
                                    }
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain179") + tableName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain180") + strFldNames[0] + System.Environment.NewLine + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain181") + valMethod + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain182") + valData + System.Environment.NewLine + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain183") + ex.Message, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain184"));
                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain185") + tableName + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain180") + strFldNames[0] + System.Environment.NewLine + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain181") + valMethod + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain182") + valData + System.Environment.NewLine + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain183") + ex.Message);
                                }
                            }
                            else
                            {
                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain186"));

                            }

                            try
                            {
                                if (intFldIdxs.Count > 0 && strFldNames.Count > 0)
                                {
                                    for (int p = 0; p < strFldNames.Count; p++)
                                    {

                                        IRowChanges inChanges = inObject as IRowChanges;
                                        bool changed = inChanges.get_ValueChanged(intFldIdxs[p]);
                                        if (changed)
                                            try
                                            {
                                                if (AAState.lastValueProperties.GetProperty(strFldNames[p]) != null)
                                                {
                                                    LastValueEntry lstVal = AAState.lastValueProperties.GetProperty(strFldNames[p]) as LastValueEntry;
                                                    if (lstVal != null)
                                                    {
                                                        if (mode == "ON_CREATE" && lstVal.On_Create == false)
                                                        {
                                                            string test = "";
                                                        }
                                                        else if (mode == "ON_MANUAL" && lstVal.On_Manual == false)
                                                        {
                                                            string test = "";
                                                        }
                                                        else if (mode == "ON_CHANGE" && lstVal.On_ChangeAtt == false)
                                                        {
                                                            string test = "";
                                                        }
                                                        else if (mode == "ON_CHANGEGEO" && lstVal.On_ChangeGeo == false)
                                                        {
                                                            string test = "";
                                                        }
                                                        else
                                                        {
                                                            if (lstVal.Value != null)
                                                            {
                                                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14p") );
                                                                if (mode == "ON_CREATE" && (inObject.get_Value(intFldIdxs[p]) == null || inObject.get_Value(intFldIdxs[p]).ToString() == ""))
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain187"));

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine("                           " + strFldNames[p] + ": " + inObject.get_Value(intFldIdxs[p]).ToString());
                                                                    lstVal.Value = inObject.get_Value(intFldIdxs[p]);

                                                                    AAState.lastValueProperties.SetProperty(strFldNames[p], lstVal);
                                                                }
                                                            }

                                                            else
                                                            {
                                                                if (mode == "ON_CREATE" && (inObject.get_Value(intFldIdxs[p]) == null || inObject.get_Value(intFldIdxs[p]).ToString() == ""))
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain187"));

                                                                }
                                                                else
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14p") );
                                                                    AAState.WriteLine("                           " + strFldNames[p] + ": " + inObject.get_Value(intFldIdxs[p]).ToString());
                                                                    lstVal.Value = inObject.get_Value(intFldIdxs[p]);

                                                                    AAState.lastValueProperties.SetProperty(strFldNames[p], lstVal);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }

                                            }
                                            catch
                                            {

                                            }

                                    }
                                }
                            }
                            catch
                            {
                                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain188"));

                            }

                            AAState.WriteLine("    ------------------------------------------------");

                        }

                    }

                }
                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain189") + System.Environment.NewLine + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain190") + ex.Message, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain184"));
                AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain189"));
                return false;

            }
            finally
            {
                if (AAState._tab == inObject.Class || AAState._gentab == inObject.Class)
                {
                    AAState.reInitExt();

                }
                //if (progressDialog != null)
                //{
                //    progressDialog.HideDialog();
                //}
                AAState.WriteLine("DONE");
                AAState.WriteLine("---------------------------------------");
                if (fCursor != null)
                {
                    Marshal.ReleaseComObject(fCursor);
                    GC.Collect(300);
                    GC.WaitForFullGCComplete();
                }
                inFeature = null;

                mseg = null;
                netFeat = null;
                iEdgeFeat = null;

                iJuncFeat = null;

                //progressDialogFactory = null;
                //stepProgressor = null;
                //progressDialog = null;
                //trackCancel = null;
                ArcMap.Application.StatusBar.set_Message(0, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain191"));
            }
        }