diff --git a/Config.daml b/Config.daml index a0cf8b1..bae219c 100644 --- a/Config.daml +++ b/Config.daml @@ -1,12 +1,12 @@  - + OliviaAddInPro AddIn de Optimización de la Limpieza Viaria para ArcGIs Pro Images\AddinDesktop32.png VSM VSM - Narvaling - 18/01/2023 12:00:00, 2023 + 18/04/2023 12:00:00, 2023 Framework diff --git a/Helper/HelperGdb.cs b/Helper/HelperGdb.cs index 9950349..aa65567 100644 --- a/Helper/HelperGdb.cs +++ b/Helper/HelperGdb.cs @@ -27,6 +27,7 @@ using ArcGIS.Core.CIM; using System.Threading; using ArcGIS.Core.Data.Exceptions; using Microsoft.Win32; +using Microsoft.WindowsAPICodePack.Dialogs; namespace OliviaAddInPro.Helper { @@ -1443,11 +1444,14 @@ namespace OliviaAddInPro.Helper if (!System.IO.Directory.Exists(outpath)) System.IO.Directory.CreateDirectory(outpath); FeatureClass fc = null; + bool debug = true; ///////////////////////////////////////////////////////// //Prepara una where_clause con las entidades que cumplen el filtro //Abre la featureclass try { + if (debug) + HelperGlobal.ponMsg("pathLayerIn " + pathLayerIn); fc = GetFtClassSync(pathLayerIn); if (fc == null) { @@ -1456,14 +1460,17 @@ namespace OliviaAddInPro.Helper } List ids = new List(); + if (debug) + HelperGlobal.ponMsg("fc " + fc.GetName() + " tipo " + fc.GetType().Name); ///////////////////////////////////////////////////////// //Añade a la lista los ids que cumplen el filtro espacial try { ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList(); } - catch - { + catch(Exception ex) + { + OutStr = "Error al seleccionar IDs. "+ex.Message; ids = new List(); } @@ -1479,7 +1486,7 @@ namespace OliviaAddInPro.Helper }*/ if (ids.Count <= 0) { - OutStr = "Error al aplicar filtro espacial en exportación"; + OutStr = "Error al aplicar filtro espacial en exportación: "+ OutStr; return false; } ///////////////////////////////////////////////////////// @@ -2133,6 +2140,17 @@ namespace OliviaAddInPro.Helper */ public static string FolderBrowseDlg(string title_, string initloc_) { + var openFileDialog = new CommonOpenFileDialog(); + //{ IsFolderPicker = true }; + if(!String.IsNullOrEmpty(initloc_)) + openFileDialog.InitialDirectory = initloc_; + openFileDialog.IsFolderPicker = true; + //openFileDialog.InitialDirectory = initloc_; + openFileDialog.Title = title_; + //openFileDialog.Filter = "Folders"; + //if (openFileDialog.ShowDialog() == true) + if (openFileDialog.ShowDialog() == CommonFileDialogResult.Ok) + return openFileDialog.FileName; return null; } diff --git a/OliviaAddInPro.csproj b/OliviaAddInPro.csproj index 58ded03..192e41a 100644 --- a/OliviaAddInPro.csproj +++ b/OliviaAddInPro.csproj @@ -47,6 +47,7 @@ + C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Framework.dll diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 3fec284..8f6e89a 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("VSM - Narvaling")] [assembly: AssemblyProduct("OliviaAddInPro")] -[assembly: AssemblyCopyright("Copyright © VSM 2022")] +[assembly: AssemblyCopyright("Copyright © VSM 2023")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.0.0")] -[assembly: AssemblyFileVersion("3.0.0.0")] +[assembly: AssemblyVersion("3.2.0.0")] +[assembly: AssemblyFileVersion("3.2.0.0")] diff --git a/Services/EjecServ.cs b/Services/EjecServ.cs index 5e66f9d..ef7d484 100644 --- a/Services/EjecServ.cs +++ b/Services/EjecServ.cs @@ -832,7 +832,6 @@ namespace OliviaAddInPro.Services string shapefile = System.IO.Path.GetFileNameWithoutExtension(path_shape); int ind = shapefile.IndexOf("_", 0); string prefijo = shapefile.Substring(ind + 1, 1); - ////////////////////////////////////////////////////////////////////////////////// //decodifica el nombre del shapefile para asignarle el correspondiente nombre en la GDB a la que se importa el shape string tratamiento = string.Empty; diff --git a/Services/FinProcServ.cs b/Services/FinProcServ.cs index 759ba5e..1dffe3b 100644 --- a/Services/FinProcServ.cs +++ b/Services/FinProcServ.cs @@ -54,7 +54,7 @@ namespace OliviaAddInPro.Services ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func)(() => { string GdbFileName = resp.Value; - + string nombAmbitos = string.Empty; if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecSecto)) //Ha terminado bien la sectorización { //actualiza los flags @@ -130,7 +130,7 @@ namespace OliviaAddInPro.Services if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecPlanif)) //Ha terminado bien la planificación { //guarda csv - GuardaCsv(inst); + GuardaCsv(inst,resp2.Value); } msg = Resource1.String_exito; @@ -209,7 +209,7 @@ namespace OliviaAddInPro.Services /* * Permite guardar el archivo CSV que contiene la secuencia que se ha llevado a cabo en las rutas en la planificación. */ - public static void GuardaCsv(TratamientoComun inst) + public static void GuardaCsv(TratamientoComun inst, string pathImport) { string auxi, nombre = null; string[] nameDokL; @@ -221,20 +221,23 @@ namespace OliviaAddInPro.Services string Filter = "Secuencia en formato CSV (*.csv)|*.csv"; inst.decode_gdb(System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData), out auxi, out nombre); - + if (!string.IsNullOrEmpty(pathImport)) + { + nombre = System.IO.Path.GetFileNameWithoutExtension(pathImport); + } //string Path = HelperGdb.SaveFileDlg(Title, DirData, inst.ServCom.EXT_CSV, Filter); string Path = string.Empty; if (OliviaGlob.CompruebaExistePath(OliviaGlob.Paths.PathGuardCsv)) Path = OliviaGlob.Paths.PathGuardCsv; else - Path = HelperGdb.SaveFileDlg(Title, DirData, null, ArcGIS.Desktop.Catalog.ItemFilters.Folders); - + //Path = HelperGdb.SaveFileDlg(Title, DirData, null, ArcGIS.Desktop.Catalog.ItemFilters.Folders); + Path = HelperGdb.FolderBrowseDlg(Title, DirData); if (string.IsNullOrEmpty(Path) || Path.Length == 0) { bool ok = HelperGlobal.ponMsg("Se va a perder el archivo que contiene la secuencia en planificación, ¿está seguro?", MessageBoxImage.Question,"OLIVIA",MessageBoxButton.YesNo); if (!ok) - GuardaCsv(inst); + GuardaCsv(inst, pathImport); } else { diff --git a/View/Configuracion/PropertyGridFilePickerFolder.xaml.cs b/View/Configuracion/PropertyGridFilePickerFolder.xaml.cs index d0b2ec3..5814350 100644 --- a/View/Configuracion/PropertyGridFilePickerFolder.xaml.cs +++ b/View/Configuracion/PropertyGridFilePickerFolder.xaml.cs @@ -53,7 +53,8 @@ namespace OliviaAddInPro.View.Configuracion private void PickFileButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog fd = new OpenFileDialog(); - var st = HelperGdb.SaveFileDlg("Seleccione carpeta", null, null, ArcGIS.Desktop.Catalog.ItemFilters.Folders); + //var st = HelperGdb.SaveFileDlg("Seleccione carpeta", null, null, ArcGIS.Desktop.Catalog.ItemFilters.Folders); + var st = HelperGdb.FolderBrowseDlg("Seleccione carpeta", null); if (!string.IsNullOrEmpty(st)) { Value = st; diff --git a/View/Recogida/PaneRecogidaSub1.xaml b/View/Recogida/PaneRecogidaSub1.xaml index fee26b9..dd38b13 100644 --- a/View/Recogida/PaneRecogidaSub1.xaml +++ b/View/Recogida/PaneRecogidaSub1.xaml @@ -49,7 +49,7 @@ - +