private void LoadNetwork(IPropertySet props) { if (null != props.GetProperty("NetworkName")) { m_networkName = props.GetProperty("NetworkName") as string; } else { throw new ArgumentNullException("NetworkName is unspecified."); } if (null == props.GetProperty("MaxFeatureCount") || false == int.TryParse(props.GetProperty("MaxFeatureCount") as string, out this.m_maxFeatureCount)) { this.m_maxFeatureCount = 5000; } this.m_outputFields = new List <string>() { "Shape_Length" }; this.m_networkContext = new NetworkContext(m_networkName, new List <string>() { FlowLineName }, new List <string>() { JunctionName, BarrierJunctionName }); this.m_networkContext.LoadGeometricNetwork(null, this.serverObjectHelper, this.logger); this.m_isReady = this.m_networkContext.IsNetworkLoaded; if (this.m_isReady) { this.m_disabledFeatureClassIDs = new List <int>() { this.m_networkContext.GetJunctionFeatureClassIdByAliasName(BarrierJunctionName).FeatureClassID }; IFeatureClass flowlineFeatureClass = this.m_networkContext.GetEdgeFeatureClassByAliasName(FlowLineName); ISpatialReference srs = AOUtilities.GetFeatureClassSpatialReference(flowlineFeatureClass, false); if (null != srs) { this.m_networkEPSG = srs.FactoryCode; } else { this.m_isReady = false; } this.m_flowDirFieldIndex = AOUtilities.GetFieldIndexByName(flowlineFeatureClass, "FlowDir"); if (this.m_flowDirFieldIndex < 0) { this.m_isReady = false; } } }
public void GetFeatureClassEPSG() { //Arrange NetworkContext ctx = new NetworkContext("Hydro", new List <string>() { "FlowlineMerge" }, new List <string>() { "Hydro_Net_Junctions", "Barriers" }); ctx.LoadGeometricNetwork(GN_Path, null, null); //Act ISpatialReference srs = AOUtilities.GetFeatureClassSpatialReference(ctx.GetEdgeFeatureClassByAliasName("FlowlineMerge"), false); //Assert Assert.IsTrue(4269 == srs.FactoryCode); }