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


C# ESRI.GetType方法代码示例

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


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

示例1: AttributeQueryTask_Async

        /// <summary>
        /// General query task, attribute query only + spatial query with attribute query combined. 
        /// </summary>
        /// <param name="whereValue">Where clause or single value</param>
        /// <param name="whereField">fieldname in case query on one field</param>
        /// <param name="layerName">layer name</param>
        /// <param name="fieldType">field type 'C','N'</param>
        /// <param name="geometry">geometry for the spatial query</param>
        public void AttributeQueryTask_Async(string whereValue, string whereField, string layerName,
		string fieldType, ESRI.ArcGIS.Client.Geometry.Geometry geometry)
        {
            try
            {
                int layerID = -1;
                var result = (from l in baseMapLayerInfos
                                            where l.Name.Equals(layerName)
                                            select l).FirstOrDefault<Helper.DataMapping.BaseMapLayerInfo>();
                string urlFeatureLayer = String.Format("{0}/{1}", result.Url, result.Id);
                layerID = result.Id;
                QueryTask queryTask = new QueryTask(urlFeatureLayer);
                Query query = new Query();
                // Specify fields to return from initial query
                query.OutFields.Add("*");
                if (whereField.Length == 0)
                {
                    // In case no single field, asume where clause in the value
                    query.Where = whereValue;
                }
                else
                {
                    // This query will just populate the attributes, so no need to return geometry
                    if (fieldType == "C")
                    {
                        query.Where = String.Format("{0} like '{1}%'", whereField, whereValue.Trim());
                    }
                    else
                        if (fieldType == "N")
                        {
                            double value = 0;
                            if (double.TryParse(whereValue, out value))
                            {
                                query.Where = String.Format("{0} ={1}", whereField, whereValue.Trim());
                            }
                            else
                            {
                                //MessageBox.Show("No valid numeric value was entered!");
                                return;
                            }
                        }
                        else
                        {
                            //MessageBox.Show("Only numeric and character queries are supported!");
                            return;
                        }
                }
                // Hnadle spatial query if needed
                if (geometry != null)
                {
                    if (geometry.GetType() == typeof(MapPoint))
                    {
                        MapPoint point = (MapPoint)geometry;
                        const double offset = 5;
                        geometry = new Envelope(point.X - offset, point.Y - offset, point.X + offset, point.Y + offset);
                    }
                    query.Geometry = geometry;
                    query.SpatialRelationship = SpatialRelationship.esriSpatialRelIntersects;
                }
                // Return geometry with result features
                queryTask.ExecuteCompleted += AttributeQueryTask_ExecuteCompleted;
                queryTask.Failed += AttributeQueryTask_Failed; // Same as for the spatial query
                query.ReturnGeometry = true;
                queryTask.ExecuteAsync(query, layerID);
            }
            catch (Exception ex)
            {
                // Todo : error handling
                messageBoxCustom.Show(String.Format("AttributeQueryTask_Async-{0}", ex.Message),
                    GisTexts.SevereError,
                    MessageBoxCustomEnum.MessageBoxButtonCustom.Ok);
            }
        }
开发者ID:jpenet,项目名称:WebArcMap,代码行数:81,代码来源:GisOperations.cs


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