コード例 #1
0
        /// <summary>
        /// Conditionally modify attributes as searched in a single pass via client supplied callback.
        /// </summary>
        /// <param name="sr">ShapeSource for this feature source</param>
        /// <param name="envelope">The envelope for vector filtering.</param>
        /// <param name="chunkSize">Number of shapes to request from the ShapeSource in each chunk</param>
        /// <param name="featureEditCallback">Callback on each feature</param>
        protected void SearchAndModifyAttributes(IShapeSource sr, Envelope envelope, int chunkSize, FeatureSourceRowEditEvent featureEditCallback)
        {
            var            samp       = new ShapefileFeatureSourceSearchAndModifyAttributeParameters(featureEditCallback);
            AttributeTable at         = null;
            int            startIndex = 0;

            do
            {
                samp.CurrentSearchAndModifyAttributeshapes = sr.GetShapes(ref startIndex, chunkSize, envelope);
                if (samp.CurrentSearchAndModifyAttributeshapes.Count > 0)
                {
                    if (null == at)
                    {
                        at = GetAttributeTable(Filename);
                    }

                    at.Edit(samp.CurrentSearchAndModifyAttributeshapes.Keys, samp.OnRowEditEvent);
                }
            } while (samp.CurrentSearchAndModifyAttributeshapes.Count == chunkSize);
        }
コード例 #2
0
        /// <summary>
        /// Conditionally modify attributes as searched in a single pass via client supplied callback.
        /// </summary>
        /// <param name="sr">ShapeSource for this feature source</param>
        /// <param name="envelope">The envelope for vector filtering.</param>
        /// <param name="chunkSize">Number of shapes to request from the ShapeSource in each chunk</param>
        /// <param name="featureEditCallback">Callback on each feature</param>
        protected void SearchAndModifyAttributes(IShapeSource sr, IEnvelope envelope, int chunkSize, FeatureSourceRowEditEvent featureEditCallback)
        {
            var samp = new ShapefileFeatureSourceSearchAndModifyAttributeParameters(featureEditCallback);
            AttributeTable at = null;
            int startIndex = 0;
            do
            {
                samp.CurrentSearchAndModifyAttributeshapes = sr.GetShapes(ref startIndex, chunkSize, envelope);
                if (samp.CurrentSearchAndModifyAttributeshapes.Count > 0)
                {
                    if (null == at)
                        at = GetAttributeTable(Filename);

                    at.Edit(samp.CurrentSearchAndModifyAttributeshapes.Keys, samp.OnRowEditEvent);
                }
            } while (samp.CurrentSearchAndModifyAttributeshapes.Count == chunkSize);
        }