Пример #1
0
        /// <summary>
        ///     Perform find functionality.
        /// </summary>
        /// <param name="findCallBack">The find call back.</param>
        protected override void InternalFind(IFindCallBack findCallBack)
        {
            try
            {
                var doc = findCallBack.Application.Document as IMxDocument;
                if (doc == null)
                {
                    return;
                }

                var map = doc.FocusMap;
                if (map == null)
                {
                    return;
                }

                var request = _Control.GetSearchRequest();
                if (request == null)
                {
                    return;
                }

                var service  = new MapSearchService();
                var response = service.Find(request, map, _CancellationTokenSource);
                var set      = new SetClass();

                foreach (var values in response.Values)
                {
                    for (int i = values.Count - 1; i >= 0; i--)
                    {
                        var featureFindData = values[i];
                        set.Add(featureFindData);

                        findCallBack.ColumnValue[0] = featureFindData.Feature.OID.ToString(CultureInfo.InvariantCulture);
                        findCallBack.ColumnValue[1] = featureFindData.Layer.Name;
                        findCallBack.Object         = featureFindData;
                        findCallBack.AddNewRow();

                        bool quitProcessing;
                        findCallBack.ProcessMessages(out quitProcessing);

                        if (quitProcessing)
                        {
                            break;
                        }
                    }
                }

                doc.ContextItem = set;
            }
            catch (Exception ex)
            {
                Log.Error(this, ex);
            }
        }
Пример #2
0
 /// <summary>
 ///     Perform find functionality.
 /// </summary>
 /// <param name="pFindCallBack"></param>
 public virtual void Find(IFindCallBack pFindCallBack)
 {
     this.InternalFind(pFindCallBack);
 }
Пример #3
0
 /// <summary>
 ///     Perform find functionality.
 /// </summary>
 /// <param name="findCallBack">The find call back.</param>
 protected abstract void InternalFind(IFindCallBack findCallBack);