本文整理汇总了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;
}
示例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");
}
}
示例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);
}
}
}
示例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;
}
示例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());});
}
示例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));
}
示例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);
}
示例8: NewFeatureCollection
static IFeatureCollection NewFeatureCollection()
{
var stub = new StubFeatures();
var features = new FeatureCollection();
features[typeof(IHttpRequestFeature)] = stub;
features[typeof(IHttpResponseFeature)] = stub;
return features;
}
示例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"));
}
示例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;
}
示例11: IndexerAlsoAddsItems
public void IndexerAlsoAddsItems()
{
var interfaces = new FeatureCollection();
var thing = new Thing();
interfaces[typeof(IThing)] = thing;
Assert.Equal(interfaces[typeof(IThing)], thing);
}
示例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);
}
}
示例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>();
}
示例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));
}
示例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);
};
}