Пример #1
0
        /// <summary>
        /// Remove layers from the map to ensure the locks are released
        /// </summary>
        new public void RemoveLayersFromMap()
        {
            // Remove layers from the map to ensure the locks are released
            ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(PropagatedError.GISFileInfo));

            ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(PriorProbability.GISFileInfo));

            if (PosteriorProbability != null)
            {
                ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(PosteriorProbability.GISFileInfo));
            }

            if (ConditionalRaster != null)
            {
                ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(ConditionalRaster.GISFileInfo));
            }

            if (SpatialCoherenceErosion != null)
            {
                ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(SpatialCoherenceErosion.GISFileInfo));
            }

            if (SpatialCoherenceDeposition != null)
            {
                ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(SpatialCoherenceDeposition.GISFileInfo));
            }

            base.RemoveLayersFromMap();
        }
Пример #2
0
        /// <summary>
        /// Delete non-ProjectRasterItem rasters (i.e. prop err and other probabilistic rasters)
        /// </summary>
        /// <param name="r"></param>
        /// <remarks>
        /// 1. Ensure the rasters is out of the map
        /// 2. Delete the raster
        /// </remarks>
        protected void DeleteRaster(Raster r)
        {
            if (r == null)
            {
                return;
            }

            if (!r.GISFileInfo.Exists)
            {
                return;
            }

            ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(r.GISFileInfo));
            r.Delete();
        }
Пример #3
0
        private void DeleteRaster(Raster raster)
        {
            try
            {
                // Raise the event to say that a GIS layer is about to be deleted.
                // This should bubble to ArcGIS so that the layer is removed from the ArcMap ToC
                ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(raster.GISFileInfo));

                // Delete the actual raster
                if (raster.GISFileInfo.Exists)
                {
                    raster.Delete();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error attempting to delete DoD raster " + raster.GISFileInfo.FullName);
                Console.WriteLine("Raster Path: ", raster.GISFileInfo.FullName);
                Console.WriteLine(ex.Message);
            }
        }
Пример #4
0
        public override void Delete()
        {
            // Get the folder
            DirectoryInfo dir = Vector.GISFileInfo.Directory;

            // Remove the layer from the ArcGIS map and then delete the dataset
            try
            {
                // Raise the event to say that a GIS layer is about to be deleted.
                // This should bubble to ArcGIS so that the layer is removed from the ArcMap ToC
                ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(Vector.GISFileInfo));

                // Delete the actual raster
                if (Vector.GISFileInfo.Exists)
                {
                    Vector.Delete();
                }
            }
            catch (Exception ex)
            {
                Console.Write("Error attempting to remove raster from ArcGIS " + Vector.GISFileInfo.FullName, ex);
            }

            try
            {
                // Delete empty directory
                if (dir.Exists && !Directory.EnumerateFileSystemEntries(dir.FullName).Any())
                {
                    dir.Delete();
                }
            }
            catch (Exception ex)
            {
                Console.Write("Error attempting to delete associated surface directory " + dir.FullName, ex);
            }
        }
Пример #5
0
 /// <summary>
 /// Remove layers from the map to ensure the locks are released
 /// </summary>
 public void RemoveLayersFromMap()
 {
     ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(RawDoD.Raster.GISFileInfo));
     ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(ThrDoD.Raster.GISFileInfo));
     ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(ThrErr.Raster.GISFileInfo));
 }
Пример #6
0
 /// <summary>
 /// Remove layers from the map to ensure the locks are released
 /// </summary>
 new public void RemoveLayersFromMap()
 {
     ProjectManager.OnGISLayerDelete(new ProjectManager.GISLayerEventArgs(PropagatedError.GISFileInfo));
     base.RemoveLayersFromMap();
 }