Пример #1
0
        private bool SaveOgrLayer(VectorLayer ogrLayer)
        {
            int        savedCount;
            SaveResult saveResult = ogrLayer.SaveChanges(out savedCount);
            bool       success    = saveResult == SaveResult.AllSaved || saveResult == SaveResult.NoChanges;

            if (!success)
            {
                // TODO: display them in a dialog when the command was called from toolbar for a single layer
                Logger.Current.Warn("Failed to save OGR layer changes: " + ogrLayer.Filename);
                DisplayOgrErrors(ogrLayer);
            }
            else
            {
                string msg = string.Format("{0}: {1}; features: {2}", saveResult.EnumToString(), ogrLayer.Name, savedCount);
                MessageService.Current.Info(msg);

                // reload from datasource to be sure that there is no stale data
                ogrLayer.ReloadFromSource(true);
            }

            return(success);
        }