diff --git a/Config.daml b/Config.daml index 882f6e4..69da287 100644 --- a/Config.daml +++ b/Config.daml @@ -1,11 +1,11 @@  - + OliviaAddInPro AddIn de Optimización de la Limpieza Viaria para ArcGIs Pro Images\AddinDesktop32.png VSM VSM - Narvaling - 08/07/2021 12:28:02, 2021 + 08/07/2022 12:00:00, 2022 Framework diff --git a/Helper/HelperGdb.cs b/Helper/HelperGdb.cs index 94676b4..989b35d 100644 --- a/Helper/HelperGdb.cs +++ b/Helper/HelperGdb.cs @@ -2043,31 +2043,44 @@ namespace OliviaAddInPro.Helper return res; } //comprueba si extiste ya el dataset - var task1 = CheckDataset(gdb, datasetName); - task1.Wait(); - if (task1.Result) - { - //comprueba si tiene la misma referencia espacial - var r = CheckSpatRefDataset(gdb, datasetName, spatref).Result; - if (r==0) + bool repite = false; + bool crea = false; + int idat = 1; + int r = 2; + while(r==2) + { + var task1 = CheckDataset(gdb, datasetName); + task1.Wait(); + if (task1.Result) { - res.Value = 0; //no hay nada que crear, existe y coincide la spatial ref - return res; - } - else if(r==2) - { - //crea un nuevo dataset y avisa - datasetName = datasetName + "_1"; - datasetNameOut = datasetName; + //comprueba si tiene la misma referencia espacial + r = CheckSpatRefDataset(gdb, datasetName, spatref).Result; + if (r == 0) + { + res.Value = 0; //no hay nada que crear, existe y coincide la spatial ref + //return res; + } + else if (r == 2) + { + //existe ese nombre, pero con otra ref espacial + //crea un nuevo dataset y avisa + datasetName = string.Format("{0}_{1}",datasetName,idat); + datasetNameOut = datasetName; + idat++; + } + else//r==1 + { + //ha dado error al comprobar + res.Value = 1; + res.Error.Add("Errores al crear el Dataset " + datasetName); + //return res; + } } else - { - //ha dado error al comprobar - res.Value = 1; - res.Error.Add("Errores al crear el Dataset " + datasetName); - return res; - } - } + r = 3; //no existe, lo crea con ese nombre + }; + if (r!=3) + return res; //no existe, lo crea var task = ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func>)(() => { diff --git a/Images/config.png b/Images/config.png deleted file mode 100644 index e635bcd..0000000 Binary files a/Images/config.png and /dev/null differ diff --git a/Images/config2.png b/Images/config2.png deleted file mode 100644 index de7e0b2..0000000 Binary files a/Images/config2.png and /dev/null differ diff --git a/Images/help16Pro.png b/Images/help16Pro.png new file mode 100644 index 0000000..ebf3560 Binary files /dev/null and b/Images/help16Pro.png differ diff --git a/Model/Limpieza.cs b/Model/Limpieza.cs index 2e704e2..33fcd62 100644 --- a/Model/Limpieza.cs +++ b/Model/Limpieza.cs @@ -148,18 +148,39 @@ namespace OliviaAddInPro.Model } /** - * Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp - */ - public override string[] GetCamposRestaura() + * Devuelve los campos característicos de la capa + */ + public override string[] GetCampos(string capa=null) { - string[] camps = { - LimpiezaDef.Campos.consulta_entidad, - LimpiezaDef.Campos.consulta_mecan, - LimpiezaDef.Campos.consulta_observ, - LimpiezaDef.Campos.consulta_anch_tip, - LimpiezaDef.Campos.consulta_tipolo, - /*LimpiezaDef.Campos.consulta_sector, - LimpiezaDef.Campos.consulta_secuen */}; + string[] camps=null; + var capa_ = !string.IsNullOrEmpty(capa) ? capa : CapaElems; + if (string.IsNullOrEmpty(capa_)) + { + ErrStr = "Error al comprobar campos en la capa."; + return camps; + } + GeometryType tipo = HelperGdb.GetGeomType(capa_); + if (tipo == GeometryType.Polyline) + { + int NCAMPS = 5; + camps = new string[NCAMPS]; + camps[0] = LimpiezaDef.Campos.consulta_entidad; + camps[1] = LimpiezaDef.Campos.consulta_mecan; + camps[2] = LimpiezaDef.Campos.consulta_observ; + camps[3] = LimpiezaDef.Campos.consulta_anch_tip; + camps[4] = LimpiezaDef.Campos.consulta_tipolo; + } + else if (tipo == GeometryType.Point)//es mobiliario, con el tipo vale + { + int NCAMPS = 1; + camps = new string[NCAMPS]; + camps[0] = LimpiezaDef.Campos.consulta_entidad; + } + else + { + ErrStr = "Error al comprobar campos en la capa."; + } + return camps; } } diff --git a/Model/OliviaConf.cs b/Model/OliviaConf.cs index 4a2ff06..8138962 100644 --- a/Model/OliviaConf.cs +++ b/Model/OliviaConf.cs @@ -99,6 +99,9 @@ namespace OliviaAddInPro.Model [Browsable(false)] public string path_exe { get; set; } + [Browsable(false)] + public string path_manual { get; set; } + [Browsable(false)] public string path_temp { get; set; } @@ -234,6 +237,20 @@ namespace OliviaAddInPro.Model [DisplayName("Campo Secuencia")] [Description("Nombre del campo Secuencia donde se indica el orden en que se trata el ámbito dentro de su sector")] public string consulta_secuen { get; set; } + + [Category("General")] + [PropertyOrder(5)] + [DisplayName("GDB para Importación")] + [Description("Gdb en la que se importarán los resultados de la ejecución")] + [Editor(typeof(PropertyGridFilePickerGDB), typeof(PropertyGridFilePickerGDB))] + public string Path_Gdb_Import { get; set; } + + [Category("General")] + [PropertyOrder(5)] + [DisplayName("Carpeta para listados (CSV)")] + [Description("Carpeta en la que se guardarán los listados en CSV de la planificación")] + [Editor(typeof(PropertyGridFilePickerFolder), typeof(PropertyGridFilePickerFolder))] + public string Path_Guarda_Csv { get; set; } #endregion #region 02CamposLimp diff --git a/Model/OliviaGlob.cs b/Model/OliviaGlob.cs index 8e491f3..f22bfda 100644 --- a/Model/OliviaGlob.cs +++ b/Model/OliviaGlob.cs @@ -12,6 +12,7 @@ using OliviaAddInPro.Helper; using System.Net; using System.Net.Sockets; using System.IO; +using System.Diagnostics; namespace OliviaAddInPro.Model { @@ -45,6 +46,7 @@ namespace OliviaAddInPro.Model public static string PathWork; // fields = HelperGdb.GetFieldsSync(fc); HelperGdb.Free(fc); diff --git a/OliviaAddInPro.csproj b/OliviaAddInPro.csproj index e8f1d77..7897709 100644 --- a/OliviaAddInPro.csproj +++ b/OliviaAddInPro.csproj @@ -173,6 +173,9 @@ MarchandoUnaDe.xaml + + PropertyGridFilePickerFolder.xaml + PropertyGridFilePickerLine.xaml @@ -250,6 +253,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -323,9 +330,6 @@ Resource1.Designer.cs - - - @@ -351,7 +355,6 @@ - @@ -360,6 +363,9 @@ + + +