Exemple #1
0
        /// <summary>Adds junction feature classes to the network dataset</summary>
        /// <remarks>
        /// - For each 'junction' element in the config file, adds a new JunctionFeatureSource to the NDS
        /// - A new feature class is extracted from *_OSM_PT using a filter specified in the config file
        /// </remarks>
        private void ExtractJunctionFeatureClasses()
        {
            IList <SourceFeatureClassInfo> junctions = _xml.JunctionFeatureClasses().ToList();

            if ((junctions == null) || (junctions.Count == 0))
            {
                return;
            }

            ConvertRequiredTagsToAttributes(false);

            foreach (SourceFeatureClassInfo junction in junctions)
            {
                string juncClassName = GetFullClassName(junction.Name);
                SelectFeaturesToNewFeatureClass(_osmPointPath, _dsPath + "\\" + juncClassName, junction.Query);

                INetworkSource junctionNetworkSource = new JunctionFeatureSourceClass();
                junctionNetworkSource.Name        = juncClassName;
                junctionNetworkSource.ElementType = esriNetworkElementType.esriNETJunction;

                IJunctionFeatureSource junctionFeatureSource = (IJunctionFeatureSource)junctionNetworkSource;
                junctionFeatureSource.UsesSubtypes = false;
                junctionFeatureSource.RemoveAllClassConnectivityGroups();
                junctionFeatureSource.ClassConnectivityPolicy = (esriNetworkJunctionConnectivityPolicy)junction.ConnectPolicy;

                _junctionSources.Add(junctionFeatureSource);
            }
        }
Exemple #2
0
        /// <summary>Assigns a class connectivity group for each edge / junction source in the xml defined groups</summary>
        private void AssignConnectivity()
        {
            int groupCount = 1;

            foreach (IList <string> group in _xml.ConnectivityGroups())
            {
                foreach (string source in group)
                {
                    string className = GetFullClassName(source);

                    IEdgeFeatureSource efs = _edgeSources.FirstOrDefault(src => ((INetworkSource)src).Name.Equals(className));
                    if (efs != null)
                    {
                        efs.ClassConnectivityGroup = groupCount;
                    }
                    else
                    {
                        IJunctionFeatureSource jfs = _junctionSources.FirstOrDefault(src => ((INetworkSource)src).Name.Equals(className));
                        if (jfs != null)
                        {
                            jfs.AddClassConnectivityGroup(groupCount);
                        }
                    }
                }

                ++groupCount;
            }
        }
        private INetworkDataset method_1(IFeatureDataset ifeatureDataset_1, string string_1)
        {
            int               num;
            IGeoDataset       dataset          = (IGeoDataset)ifeatureDataset_1;
            ISpatialReference spatialReference = dataset.SpatialReference;
            IDENetworkDataset dataset2         = new DENetworkDatasetClass();
            IDataElement      element          = (IDataElement)dataset2;
            IDEGeoDataset     dataset3         = (IDEGeoDataset)dataset2;

            element.Name              = string_1;
            dataset2.Buildable        = true;
            dataset3.SpatialReference = spatialReference;
            IArray array = new ArrayClass();

            for (num = 0; num < this.FeatureClassWraps.Count; num++)
            {
                if (this.FeatureClassWraps[num].IsUse)
                {
                    INetworkSource source;
                    IFeatureClass  featureClass = this.FeatureClassWraps[num].FeatureClass;
                    if (featureClass.ShapeType == esriGeometryType.esriGeometryPoint)
                    {
                        source = new JunctionFeatureSourceClass
                        {
                            Name = this.FeatureClassWraps[num].ToString()
                        };
                        IJunctionFeatureSource source2 = (IJunctionFeatureSource)source;
                        source2.ClassConnectivityPolicy =
                            (esriNetworkJunctionConnectivityPolicy)
                            this.FeatureClassWraps[num].NetworkConnectivityPolicy;
                        if (this.ModifyConnectivity)
                        {
                            source2.ElevationFieldName = this.FeatureClassWraps[num].ElevationFieldName;
                        }
                        array.Add(source);
                    }
                    else if (featureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                    {
                        source = new EdgeFeatureSourceClass();
                        IEdgeFeatureSource source3 = (IEdgeFeatureSource)source;
                        source.Name = this.FeatureClassWraps[num].ToString();
                        source3.ClassConnectivityGroup  = 1;
                        source3.ClassConnectivityPolicy =
                            (esriNetworkEdgeConnectivityPolicy)this.FeatureClassWraps[num].NetworkConnectivityPolicy;
                        if (this.ModifyConnectivity)
                        {
                            source3.FromElevationFieldName = this.FeatureClassWraps[num].FromElevationFieldName;
                            source3.ToElevationFieldName   = this.FeatureClassWraps[num].ToElevationFieldName;
                        }
                        array.Add(source);
                    }
                }
            }
            dataset2.Sources = array;
            for (num = 0; num < this.iarray_0.Count; num++)
            {
                dataset2.Attributes.Add(this.iarray_0.get_Element(num));
            }
            dataset2.SupportsTurns = this.bool_2;
            IFeatureDatasetExtensionContainer container = (IFeatureDatasetExtensionContainer)ifeatureDataset_1;
            IDatasetContainer2 container2 =
                (IDatasetContainer2)container.FindExtension(esriDatasetType.esriDTNetworkDataset);

            return((INetworkDataset)container2.CreateDataset((IDEDataset)dataset2));
        }