123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using ESRI.ArcGIS.Geodatabase;
- namespace GNetworkProcessTool
- {
-
-
-
- public class GNetworkHelper
- {
-
-
-
- private static Dictionary<int, Dictionary<string, int>> _dicLayerFieldIndex = new Dictionary<int, Dictionary<string, int>>();
-
-
-
-
-
- public static bool CheckConnectionZeroLength(IFeature featChecking)
- {
- bool __bErrorConnection = false;
- if (featChecking.FeatureType == esriFeatureType.esriFTSimpleEdge)
- {
- IEdgeFeature __simEdge = featChecking as IEdgeFeature;
- __bErrorConnection = (__simEdge.FromJunctionEID == __simEdge.ToJunctionEID);
- }
- return (__bErrorConnection == false);
- }
-
-
-
-
-
- public static bool CheckConnectionEdge(IFeature featChecking)
- {
- bool __bErrorConnection = false;
- if (featChecking.FeatureType == esriFeatureType.esriFTSimpleEdge)
- {
- if (GNetworkHelper._dicLayerFieldIndex.ContainsKey(featChecking.Class.ObjectClassID) == false)
- {
- GNetworkHelper._dicLayerFieldIndex.Add(featChecking.Class.ObjectClassID, new Dictionary<string, int>());
- GNetworkHelper._dicLayerFieldIndex[featChecking.Class.ObjectClassID].Add("NODE1_ID", featChecking.Fields.FindField("NODE1_ID"));
- GNetworkHelper._dicLayerFieldIndex[featChecking.Class.ObjectClassID].Add("NODE2_ID", featChecking.Fields.FindField("NODE2_ID"));
- }
- IEdgeFeature __simEdge = featChecking as IEdgeFeature;
- ISimpleJunctionFeature __simJunctionFrom = __simEdge.FromJunctionFeature as ISimpleJunctionFeature;
- ISimpleJunctionFeature __simJunctionTo = __simEdge.ToJunctionFeature as ISimpleJunctionFeature;
- string __strFJunctionClass = ((__simEdge.FromJunctionFeature as IFeature).Class as IDataset).BrowseName;
- string __strTJunctionClass = ((__simEdge.ToJunctionFeature as IFeature).Class as IDataset).BrowseName;
- if ((__strFJunctionClass.EndsWith("GASDATASET_Net_Junctions") && __simJunctionFrom.EdgeFeatureCount == 1)
- || (__strTJunctionClass.EndsWith("GASDATASET_Net_Junctions") && __simJunctionTo.EdgeFeatureCount == 1))
- {
- string __strNode1 = Convert.ToString(featChecking.get_Value(GNetworkHelper._dicLayerFieldIndex[featChecking.Class.ObjectClassID]["NODE1_ID"]));
- string __strNode2 = Convert.ToString(featChecking.get_Value(GNetworkHelper._dicLayerFieldIndex[featChecking.Class.ObjectClassID]["NODE2_ID"]));
- __bErrorConnection = (__strNode1 != "0" || __strNode2 != "0");
- }
- }
- return (__bErrorConnection == false);
- }
-
-
-
-
-
- public static bool CheckConnectionTEE(IFeature featChecking)
- {
- bool __bErrorConnection = false;
- if (featChecking.FeatureType == esriFeatureType.esriFTSimpleJunction && (featChecking.Class as IDataset).BrowseName.EndsWith("TEE_N"))
- {
- if (GNetworkHelper._dicLayerFieldIndex.ContainsKey(featChecking.Class.ObjectClassID) == false)
- {
- GNetworkHelper._dicLayerFieldIndex.Add(featChecking.Class.ObjectClassID, new Dictionary<string, int>());
- GNetworkHelper._dicLayerFieldIndex[featChecking.Class.ObjectClassID].Add("NODE1_ID", featChecking.Fields.FindField("NODE1_ID"));
- GNetworkHelper._dicLayerFieldIndex[featChecking.Class.ObjectClassID].Add("NODE2_ID", featChecking.Fields.FindField("NODE2_ID"));
- }
- string __strNode1 = Convert.ToString(featChecking.get_Value(GNetworkHelper._dicLayerFieldIndex[featChecking.Class.ObjectClassID]["NODE1_ID"]));
- string __strNode2 = Convert.ToString(featChecking.get_Value(GNetworkHelper._dicLayerFieldIndex[featChecking.Class.ObjectClassID]["NODE2_ID"]));
- ISimpleJunctionFeature __simJunction = featChecking as ISimpleJunctionFeature;
- __bErrorConnection = (__strNode1 != "0" && __strNode2 != "0" && __simJunction.EdgeFeatureCount < 2);
- }
- return (__bErrorConnection == false);
- }
- }
- }
|