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


C# FeatureLayer.GenerateFeatureCollectionJson方法代码示例

本文整理汇总了C#中FeatureLayer.GenerateFeatureCollectionJson方法的典型用法代码示例。如果您正苦于以下问题:C# FeatureLayer.GenerateFeatureCollectionJson方法的具体用法?C# FeatureLayer.GenerateFeatureCollectionJson怎么用?C# FeatureLayer.GenerateFeatureCollectionJson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FeatureLayer的用法示例。


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

示例1: WriteFeatureLayer

        private void WriteFeatureLayer(FeatureLayer layer)
        {   
            WriteAttribute("Url", layer.Url);
            if (!string.IsNullOrEmpty(layer.Where))
            {
                WriteAttribute("Where", layer.Where);
            }
            if (!LayerExtensions.GetUsesProxy(layer))
            {
                if (!string.IsNullOrEmpty(layer.ProxyUrl))
                {
                    WriteAttribute("ProxyUrl", layer.ProxyUrl);
                }
                if (!string.IsNullOrEmpty(layer.Token))
                {
                    WriteAttribute("Token", layer.Token);
                }
            }
            if (!string.IsNullOrEmpty(layer.Text))
            {
                WriteAttribute("Text", layer.Text);
            }
			if (layer.MinimumResolution > double.Epsilon)
            {
                WriteAttribute("MinimumResolution", layer.MinimumResolution);
            }
            if (layer.MaximumResolution < double.MaxValue)
            {
                WriteAttribute("MaximumResolution", layer.MaximumResolution);
            }
            if (layer.Mode == FeatureLayer.QueryMode.OnDemand)
            {
                WriteAttribute("Mode", layer.Mode.ToString());
                if (layer.OnDemandCacheSize != 1000)
                    WriteAttribute("OnDemandCacheSize", layer.OnDemandCacheSize.ToString());
            }

            if (layer.OutFields != null && layer.OutFields.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (string value in layer.OutFields)
                {
                    sb.AppendFormat("{0},", value);
                }
                string str = sb.ToString();
                if (str.Length > 0)
                {
                    str = str.Remove(str.Length - 1); // remove trailing ,
                    writer.WriteAttributeString("OutFields", str);
                }
            }
			if (layer.Geometry != null)
            {
                //TODO
            }

            if (layer.ObjectIDs != null && layer.ObjectIDs.Length > 0)
            {
                string oidString = "";
                foreach (int oid in layer.ObjectIDs)
                    oidString += oid.ToString() + ",";
                oidString = oidString.Substring(0, oidString.Length - 1);

                writer.WriteAttributeString("ObjectIDs", oidString);
            }

			// Serialize feature collection JSON for feature collection layers
            if (string.IsNullOrEmpty(layer.Url) && layer.LayerInfo != null) 
            {
                // feature collection layer.  Retrieve and store feature collection JSON

                string json = layer.GenerateFeatureCollectionJson();
                if (!string.IsNullOrEmpty(json))
                {
                    writer.WriteElementString(Constants.esriMappingPrefix,
                        "LayerExtensions.FeatureCollectionJson", Constants.esriMappingNamespace, json);
                }
            }

            WriteBaseElementContents(layer);
            WriteGraphicsLayerElements(layer);
            
        }
开发者ID:Esri,项目名称:arcgis-viewer-silverlight,代码行数:83,代码来源:FeatureLayerXamlWriter.cs


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