当前位置: 首页>>代码示例>>C#>>正文


C# FeatureCollection类代码示例

本文整理汇总了C#中FeatureCollection的典型用法代码示例。如果您正苦于以下问题:C# FeatureCollection类的具体用法?C# FeatureCollection怎么用?C# FeatureCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FeatureCollection类属于命名空间,在下文中一共展示了FeatureCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateFeatures

        /// <summary>
        /// Compare source and target features
        /// </summary>
        /// <param name="sFeatures">Source features</param>
        /// <param name="tFeatures">Target features</param>
        /// <returns>True if the features match, false otherwise</returns>
        public static bool ValidateFeatures(FeatureCollection sFeatures, FeatureCollection tFeatures)
        {
            int sCount = 0;
            int tCount = 0;

            foreach (Feature sFeature in sFeatures)
            {
                sCount++;
                Guid sID = sFeature.Id;

                Feature tFeature = tFeatures.Where(ft => ft.Id == sID).FirstOrDefault();
                
                // Feature activation: do we see the target feature with the correct id?
                // Feature deactivation: we shouldn't see the target feature anymore when we choose to deactivate
                if ((tFeature != null && sID == tFeature.Id) || (sFeature.Deactivate && tFeature == null))
                {
                    tCount++;
                }
            }

            if (sCount != tCount)
            {
                return false;
            }

            return true;
        }
开发者ID:stijnbrouwers,项目名称:PnP-Sites-Core,代码行数:33,代码来源:FeatureValidator.cs

示例2: OpenFeaturesFromArcGISOnline

        private async void OpenFeaturesFromArcGISOnline(string itemId)
        {
            try
            {
                // Open a portal item containing a feature collection
                ArcGISPortal portal = await ArcGISPortal.CreateAsync();
                PortalItem collectionItem = await PortalItem.CreateAsync(portal, itemId);

                // Verify that the item is a feature collection
                if (collectionItem.Type == PortalItemType.FeatureCollection)
                {
                    // Create a new FeatureCollection from the item
                    FeatureCollection featCollection = new FeatureCollection(collectionItem);

                    // Create a layer to display the collection and add it to the map as an operational layer
                    FeatureCollectionLayer featCollectionLayer = new FeatureCollectionLayer(featCollection);
                    featCollectionLayer.Name = collectionItem.Title;
                    MyMapView.Map.OperationalLayers.Add(featCollectionLayer);
                }
                else
                {
                    MessageBox.Show("Portal item with ID '" + itemId + "' is not a feature collection.", "Feature Collection");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to open item with ID '" + itemId + "': " + ex.Message, "Error");
            }
        }        
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:29,代码来源:FeatureCollectionLayerFromPortal.xaml.cs

示例3: clusterThread_RunWorkerCompleted

 private void clusterThread_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if ((!e.Cancelled) && (e.Result != null))
     {
         Dictionary<int, Cluster> result = e.Result as Dictionary<int, Cluster>;
         if (result != null)
         {
             FeatureCollection clusters = new FeatureCollection();
             int num = 0;
             foreach (int num2 in result.Keys)
             {
                 if (result.ContainsKey(num2))
                     num = Math.Max(result[num2].Count, num);
             }
             foreach (int num3 in result.Keys)
             {
                 if (result.ContainsKey(num3) && result[num3].Features.Count == 1)
                 {
                     clusters.Add(result[num3].Features[0]);
                 }
                 else if (result.ContainsKey(num3))
                 {
                     Feature item = this.OnCreateFeature(result[num3].Features, new GeoPoint(result[num3].X, result[num3].Y), num);
                     item.DisableToolTip = true;
                     item.SetValue(Clusterer.ClusterProperty, result[num3].Features);
                     clusters.Add(item);
                 }
             }
             base.OnClusteringCompleted(clusters);
         }
     }
 }
开发者ID:SuperMap,项目名称:iClient-for-Win8,代码行数:32,代码来源:FeaturesClusterer.cs

示例4: OnCreateFeature

        protected override Feature OnCreateFeature(FeatureCollection cluster, GeoPoint center, int maxClusterCount)
        {
            double sum = 0;
            Feature feature = null;
            foreach (Feature item in cluster)
            {
                if (item.Attributes.ContainsKey(AggregateColumn))
                {
                    sum += Convert.ToDouble(item.Attributes[AggregateColumn]);
                }
            }
            double size = (sum + 450) / 30;
            size = Math.Log(sum * StyleScale / 10) * 10 + 20;
            if (size < 12)
            {
                size = 12;
            }
            CustomClusterStyle s = new CustomClusterStyle();
            feature = new Feature() { Style = new CustomClusterStyle() { Size = size }, Geometry = center };
            feature.Attributes.Add("Color", InterPlateColor(size - 12, 100));
            feature.Attributes.Add("Size", size);
            feature.Attributes.Add("Count", cluster.Count);

            return feature;
        }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:25,代码来源:CustomClustererTest.xaml.cs

示例5: HandleRequest

 private Task HandleRequest(IDictionary<string, object> env)
 {
     var ofc = new FeatureCollection(new OwinFeatureCollection(env));
     var t = _callback.Invoke(ofc);
     return t;
     //return TaskHelpers.Await(t, () => {Console.WriteLine("done");}, (ex) => {Console.WriteLine("failed with " + ex.ToString());});
 }
开发者ID:borgdylan,项目名称:aspnet5-repros,代码行数:7,代码来源:NowinServerFactory.cs

示例6: CreateServer

 public IServer CreateServer(IConfiguration configuration)
 {
     var information = new ServerInformation(configuration);
     var serverFeatures = new FeatureCollection();
     serverFeatures.Set<IServerInformation>(information);
     serverFeatures.Set<IServerAddressesFeature>(information);
     return new Server(serverFeatures, _appLifetime, _loggerFactory.CreateLogger(Server.ConfigServerAssembly));
 }
开发者ID:bestwpw,项目名称:RestBus,代码行数:8,代码来源:ServerFactory.cs

示例7: MainViewModel

 public MainViewModel(IEnumerable<IFeature> features)
 {
     this.features = new FeatureCollection(features);
     this.featuresView = CollectionViewSource.GetDefaultView(this.features);
     this.featuresView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(IFeature.GroupName)));
     this.featuresView.SortDescriptions.Add(new SortDescription(nameof(IFeature.Order), ListSortDirection.Ascending));
     this.addOrRemoveFeaturesCommand = new AsyncDelegateCommand(this.AddOrRemoveFeatures);
 } 
开发者ID:fmoliveira,项目名称:ASP.NET-MVC-Boilerplate,代码行数:8,代码来源:MainViewModel.cs

示例8: NewFeatureCollection

 static IFeatureCollection NewFeatureCollection()
 {
     var stub = new StubFeatures();
     var features = new FeatureCollection();
     features[typeof(IHttpRequestFeature)] = stub;
     features[typeof(IHttpResponseFeature)] = stub;
     return features;
 }
开发者ID:yonglehou,项目名称:Hosting,代码行数:8,代码来源:HostingEngineTests.cs

示例9: CreateServer

 public IServer CreateServer(IConfiguration configuration)
 {
     var information = new KestrelServerInformation(configuration);
     var serverFeatures = new FeatureCollection();
     serverFeatures.Set<IKestrelServerInformation>(information);
     serverFeatures.Set<IServerAddressesFeature>(information);
     return new KestrelServer(serverFeatures, _appLifetime, _loggerFactory.CreateLogger("Microsoft.AspNet.Server.Kestrel"));
 }
开发者ID:leloulight,项目名称:KestrelHttpServer,代码行数:8,代码来源:ServerFactory.cs

示例10: Initialize

 public IFeatureCollection Initialize(IConfiguration configuration)
 {
     var information = new KestrelServerInformation();
     information.Initialize(configuration);
     var serverFeatures = new FeatureCollection();
     serverFeatures.Set<IKestrelServerInformation>(information);
     serverFeatures.Set<IServerAddressesFeature>(information);
     return serverFeatures;
 }
开发者ID:rogeralsing,项目名称:KestrelHttpServer,代码行数:9,代码来源:ServerFactory.cs

示例11: IndexerAlsoAddsItems

        public void IndexerAlsoAddsItems()
        {
            var interfaces = new FeatureCollection();
            var thing = new Thing();

            interfaces[typeof(IThing)] = thing;

            Assert.Equal(interfaces[typeof(IThing)], thing);
        }
开发者ID:leloulight,项目名称:HttpAbstractions,代码行数:9,代码来源:FeatureCollectionTests.cs

示例12: Initialize

 public static void Initialize(FeatureCollection featureList, IUserListReader userListReader)
 {
     FeatureToggles = new List<BasicToggleType>();
     foreach (FeatureElement feature in featureList)
     {
         var toggleType = CreateToggleType(feature, userListReader);
         FeatureToggles.Add(toggleType);
     }
 }
开发者ID:esivertsson,项目名称:asp-net-feature-toggle,代码行数:9,代码来源:FeatureToggle.cs

示例13: EditFeatures

 public EditFeatures()
 {
     InitializeComponent();
     drawLayer = MyMap.Layers["DrawLayer"] as FeaturesLayer;
     tempLayer = MyMap.Layers["TempLayer"] as FeaturesLayer;
     layer = MyMap.Layers["MyLayer"] as TiledDynamicRESTLayer;
     features = new FeatureCollection();
     featureIDs = new List<int>();
 }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:9,代码来源:EditFeatures.xaml.cs

示例14: SecondCallToAddThrowsException

        public void SecondCallToAddThrowsException()
        {
            var interfaces = new FeatureCollection();
            var thing = new Thing();

            interfaces.Add(typeof(IThing), thing);

            Assert.Throws<ArgumentException>(() => interfaces.Add(typeof(IThing), thing));
        }
开发者ID:mchenx,项目名称:HttpAbstractions,代码行数:9,代码来源:InterfaceDictionaryTests.cs

示例15: GetGeoJsonContents

        /// <summary>
        /// Gets a stream for a given feature collection.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private static Action<Stream> GetGeoJsonContents(FeatureCollection model)
        {
            return stream =>
            {
                var geoJson = OsmSharp.Geo.Streams.GeoJson.GeoJsonConverter.ToGeoJson(model as FeatureCollection);

                var geoJsonBytes = System.Text.Encoding.UTF8.GetBytes(geoJson);
                stream.Write(geoJsonBytes, 0, geoJsonBytes.Length);
            };
        }
开发者ID:nagyistoce,项目名称:OsmSharp-routing-api,代码行数:15,代码来源:GeoJsonResponse.cs


注:本文中的FeatureCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。