public static StopperJunctions GetStoppers(NetworkContext ctx, List <IPoint> pnts, bool isUpStream, double distance, double toleranceOnDist, string edgeFeatureClassAliasName, string junctionFeatureClassAliasName, ServerLogger logger) { StopperJunctions stoppers = null; if (null != pnts && pnts.Count > 0 && distance > 0 && toleranceOnDist > 0 && null != ctx && false == string.IsNullOrEmpty(edgeFeatureClassAliasName) && false == string.IsNullOrEmpty(junctionFeatureClassAliasName)) { IFeatureClass edgeFeatureClass = ctx.GetEdgeFeatureClassByAliasName(edgeFeatureClassAliasName); IFeatureClass junctionFeatureClass = ctx.GetJunctionFeatureClassIdByAliasName(junctionFeatureClassAliasName); if (null != edgeFeatureClass && null != junctionFeatureClass) { List <int> stopperIds = new List <int>(); foreach (var pnt in pnts) { if (false == pnt.IsEmpty && pnt.X > -180 && pnt.X < 180 && pnt.Y > -90 && pnt.Y < 90) { Tuple <double, double> distD = GLC.AO.AOUtilities.GetEstimatedDistInDegree(pnt.X, pnt.Y, distance, 1.0); if (null != distD && distD.Item2 < toleranceOnDist) { Tuple <int, IFeature, double> stopperEdge = GLC.AO.AOUtilities.FindNearestFeature(pnt, edgeFeatureClass, distD.Item1, logger); if (null != stopperEdge) { Tuple <int, int> juncFrom2 = NetworkHelper.FindJunctionsOnEdge(stopperEdge.Item2, junctionFeatureClass, null); if (isUpStream && juncFrom2.Item1 > 0) { stopperIds.Add(juncFrom2.Item1); } else if (!isUpStream && juncFrom2.Item2 > 0) { stopperIds.Add(juncFrom2.Item2); } } } } } if (stopperIds.Count > 0) { stoppers = new StopperJunctions(junctionFeatureClass, stopperIds); } } } return(stoppers); }
public static StopperJunctions GetStoppers(NetworkContext ctx, string junctionFeatureClassAliasName) { StopperJunctions stoppers = null; if (null != ctx && false == string.IsNullOrEmpty(junctionFeatureClassAliasName)) { IFeatureClass junctionFeatureClass = ctx.GetJunctionFeatureClassIdByAliasName(junctionFeatureClassAliasName); if (null != junctionFeatureClass) { int ftrCnt = junctionFeatureClass.FeatureCount(null); if (ftrCnt > 0) { int[] arr = new int[ftrCnt]; for (int i = 0; i < ftrCnt; ++i) { arr[i] = i + 1; } stoppers = new StopperJunctions(junctionFeatureClass, arr); } } } return(stoppers); }
public static StopperJunctions GetStoppersEID(NetworkContext ctx, string junctionFeatureClassAliasName) { StopperJunctions stoppers = null; if (null != ctx && null != ctx.GeometricNetwork && false == string.IsNullOrEmpty(junctionFeatureClassAliasName)) { IFeatureClass junctionFeatureClass = ctx.GetJunctionFeatureClassIdByAliasName(junctionFeatureClassAliasName); INetElements netElements = ctx.GeometricNetwork.Network as INetElements; if (null != junctionFeatureClass && null != netElements) { int ftrCnt = junctionFeatureClass.FeatureCount(null); if (ftrCnt > 0) { int[] arr = new int[ftrCnt]; for (int i = 0; i < ftrCnt; ++i) { arr[i] = netElements.GetEID(junctionFeatureClass.FeatureClassID, i + 1, -1, esriElementType.esriETJunction); } stoppers = new StopperJunctions(junctionFeatureClass, arr); } } } return(stoppers); }